BeneficiaryTransformer { public static Patient transform(MetricRegistry metricRegistry, Beneficiary beneficiary, IncludeIdentifiersMode includeIdentifiersMode) { Timer.Context timer = metricRegistry .timer(MetricRegistry.name(BeneficiaryTransformer.class.getSimpleName(), "transform")).time(); Patient patient = transform(beneficiary, includeIdentifiersMode); timer.stop(); return patient; }  static Patient transform(MetricRegistry metricRegistry, Beneficiary beneficiary,
			IncludeIdentifiersMode includeIdentifiersMode);  }
@Test public void transformSampleARecord() { Beneficiary beneficiary = loadSampleABeneficiary(); Patient patient = BeneficiaryTransformer.transform(new MetricRegistry(), beneficiary, IncludeIdentifiersMode.OMIT_HICNS_AND_MBIS); assertMatches(beneficiary, patient); Assert.assertEquals(2, patient.getIdentifier().size()); }
@Test public void transformSampleARecordWithIdentifiers() { Beneficiary beneficiary = loadSampleABeneficiary(); Patient patient = BeneficiaryTransformer.transform(new MetricRegistry(), beneficiary, IncludeIdentifiersMode.INCLUDE_HICNS_AND_MBIS); assertMatches(beneficiary, patient); Assert.assertEquals(7, patient.getIdentifier().size()); }
@Test public void transformBeneficiaryWithAllOptionalsEmpty() { 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(); TransformerTestUtils.setAllOptionalsToEmpty(beneficiary); Patient patient = BeneficiaryTransformer.transform(new MetricRegistry(), beneficiary, IncludeIdentifiersMode.OMIT_HICNS_AND_MBIS); assertMatches(beneficiary, patient); }