@Test public void metadataReportedCorrectly() throws ComponentLookupException { when(this.familyRepository.getFamilyForPatient(this.patient)).thenReturn(this.family); Map<String, Object> result = this.mocker.getComponentUnderTest().provideMetadata(this.patient); Assert.assertEquals(1, result.size()); Assert.assertEquals("FAM0001234", result.get("family")); }
@Override public Map<String, Object> provideMetadata(PrimaryEntity entity) { if (entity instanceof Patient) { Family f = this.familyRepository.getFamilyForPatient((Patient) entity); if (f != null) { return Collections.singletonMap("family", f.getId()); } } return Collections.emptyMap(); }
PatientFamilyMetadataProvider implements PrimaryEntityMetadataProvider { @Override public Map<String, Object> provideMetadata(PrimaryEntity entity) { if (entity instanceof Patient) { Family f = this.familyRepository.getFamilyForPatient((Patient) entity); if (f != null) { return Collections.singletonMap("family", f.getId()); } } return Collections.emptyMap(); } }
PatientFamilyMetadataProvider implements PrimaryEntityMetadataProvider { @Override public Map<String, Object> provideMetadata(PrimaryEntity entity) { if (entity instanceof Patient) { Family f = this.familyRepository.getFamilyForPatient((Patient) entity); if (f != null) { return Collections.singletonMap("family", f.getId()); } } return Collections.emptyMap(); }  }
PatientFamilyMetadataProvider implements PrimaryEntityMetadataProvider { @Override public Map<String, Object> provideMetadata(PrimaryEntity entity) { if (entity instanceof Patient) { Family f = this.familyRepository.getFamilyForPatient((Patient) entity); if (f != null) { return Collections.singletonMap("family", f.getId()); } } return Collections.emptyMap(); }  @Override Map<String, Object> provideMetadata(PrimaryEntity entity); }
PatientFamilyMetadataProvider implements PrimaryEntityMetadataProvider { @Override public Map<String, Object> provideMetadata(PrimaryEntity entity) { if (entity instanceof Patient) { Family f = this.familyRepository.getFamilyForPatient((Patient) entity); if (f != null) { return Collections.singletonMap("family", f.getId()); } } return Collections.emptyMap(); }  @Override Map<String, Object> provideMetadata(PrimaryEntity entity);  }