@Test public void emptyMapReturnedIfFamilyUnknown() throws ComponentLookupException { when(this.familyRepository.getFamilyForPatient(this.patient)).thenReturn(null); Map<String, Object> result = this.mocker.getComponentUnderTest().provideMetadata(this.patient); Assert.assertTrue(result.isEmpty()); }
@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);  }