@Test public void loadReturnsContactsFromTheManager() throws ComponentLookupException { when(this.manager.getAll(this.patient)).thenReturn(Arrays.asList(this.contact1, this.contact2, this.contact3)); PatientData<ContactInfo> result = this.mocker.getComponentUnderTest().load(this.patient); Assert.assertTrue(result.isIndexed()); Assert.assertEquals(3, result.size()); Assert.assertSame(this.contact1, result.get(0)); Assert.assertSame(this.contact2, result.get(1)); Assert.assertSame(this.contact3, result.get(2)); }
@Override public PatientData<ContactInfo> load(Patient patient) { List<ContactInfo> contacts = this.contactsManager.getAll(patient); if (contacts == null || contacts.isEmpty()) { return null; } return new IndexedPatientData<>(getName(), contacts); }
ContactInformationController implements PatientDataController<ContactInfo> { @Override public PatientData<ContactInfo> load(Patient patient) { List<ContactInfo> contacts = this.contactsManager.getAll(patient); if (contacts == null || contacts.isEmpty()) { return null; } return new IndexedPatientData<>(getName(), contacts); } }
ContactInformationController implements PatientDataController<ContactInfo> { @Override public PatientData<ContactInfo> load(Patient patient) { List<ContactInfo> contacts = this.contactsManager.getAll(patient); if (contacts == null || contacts.isEmpty()) { return null; } return new IndexedPatientData<>(getName(), contacts); }  }
ContactInformationController implements PatientDataController<ContactInfo> { @Override public PatientData<ContactInfo> load(Patient patient) { List<ContactInfo> contacts = this.contactsManager.getAll(patient); if (contacts == null || contacts.isEmpty()) { return null; } return new IndexedPatientData<>(getName(), contacts); }  @Override PatientData<ContactInfo> load(Patient patient); @Override void save(Patient patient); @Override void save(final Patient patient, final PatientWritePolicy policy); @Override void writeJSON(Patient patient, JSONObject json); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<ContactInfo> readJSON(JSONObject json); @Override String getName(); }
ContactInformationController implements PatientDataController<ContactInfo> { @Override public PatientData<ContactInfo> load(Patient patient) { List<ContactInfo> contacts = this.contactsManager.getAll(patient); if (contacts == null || contacts.isEmpty()) { return null; } return new IndexedPatientData<>(getName(), contacts); }  @Override PatientData<ContactInfo> load(Patient patient); @Override void save(Patient patient); @Override void save(final Patient patient, final PatientWritePolicy policy); @Override void writeJSON(Patient patient, JSONObject json); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<ContactInfo> readJSON(JSONObject json); @Override String getName();  }