CoverageTransformer { public static Coverage transform(MetricRegistry metricRegistry, MedicareSegment medicareSegment, Beneficiary beneficiary) { Objects.requireNonNull(medicareSegment); if (medicareSegment == MedicareSegment.PART_A) return transformPartA(metricRegistry, beneficiary); else if (medicareSegment == MedicareSegment.PART_B) return transformPartB(metricRegistry, beneficiary); else if (medicareSegment == MedicareSegment.PART_C) return transformPartC(metricRegistry, beneficiary); else if (medicareSegment == MedicareSegment.PART_D) return transformPartD(metricRegistry, beneficiary); else throw new BadCodeMonkeyException(); }  static Coverage transform(MetricRegistry metricRegistry, MedicareSegment medicareSegment,
			Beneficiary beneficiary); static List<IBaseResource> transform(MetricRegistry metricRegistry, Beneficiary beneficiary);  }
@Test public void transformSampleARecord() throws FHIRException { List<Object> parsedRecords = ServerTestUtils .parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources())); Beneficiary beneficiary = parsedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r) .findFirst().get(); Coverage partACoverage = CoverageTransformer.transform(new MetricRegistry(), MedicareSegment.PART_A, beneficiary); assertPartAMatches(beneficiary, partACoverage); Coverage partBCoverage = CoverageTransformer.transform(new MetricRegistry(), MedicareSegment.PART_B, beneficiary); assertPartBMatches(beneficiary, partBCoverage); Coverage partCCoverage = CoverageTransformer.transform(new MetricRegistry(), MedicareSegment.PART_C, beneficiary); assertPartCMatches(beneficiary, partCCoverage); Coverage partDCoverage = CoverageTransformer.transform(new MetricRegistry(), MedicareSegment.PART_D, beneficiary); assertPartDMatches(beneficiary, partDCoverage); }