### Question:
HardyWeinbergScoreCalculatorTask implements Task<Variant, Variant> { @Override public List<Variant> apply(List<Variant> list) throws Exception { List<Variant> result = new ArrayList<>(list.size()); for (Variant variant : list) { result.add(apply(variant)); } return result; } HardyWeinbergScoreCalculatorTask(String studyId, String cohortName); @Override List<Variant> apply(List<Variant> list); Variant apply(Variant variant); static final String SCORE_ID; }### Answer:
@Test public void testHW() throws Exception { HardyWeinbergScoreCalculatorTask task = new HardyWeinbergScoreCalculatorTask(STUDY, "ALL"); Variant variant = new VariantBuilder("1:100:A:C") .setStudyId(STUDY) .build(); variant.getStudy(STUDY).setStats(Collections.singletonList(new VariantStats() .setCohortId("ALL") .addGenotype(new Genotype("0/0"), 50) .addGenotype(new Genotype("0/1"), 20) .addGenotype(new Genotype("1/1"), 5) )); task.apply(variant); VariantScore score = variant.getStudy(STUDY).getScores().get(0); assertNotNull(score); assertEquals(HardyWeinbergScoreCalculatorTask.SCORE_ID, score.getId()); }