PatientUtilsFragmentController { public SimpleObject[] getFathers(@RequestParam("patientId") Patient patient,UiUtils ui) { List<Person> people = new ArrayList<Person>(); for (Relationship relationship : Context.getPersonService().getRelationshipsByPerson(patient)) { if (relationship.getRelationshipType().getbIsToA().equals("Parent")) { if (relationship.getPersonB().getGender().equals("M")) { people.add(relationship.getPersonB()); } } if (relationship.getRelationshipType().getaIsToB().equals("Parent")) { if (relationship.getPersonA().getGender().equals("M")) { people.add(relationship.getPersonA()); } } } return ui.simplifyCollection(people); }  @SharedAction List<SimpleObject> getFlags(@RequestParam("patientId") Integer patientId, @SpringBean CalculationManager calculationManager); @SharedAction List<SimpleObject> getScheduled(@RequestParam("date") Date date, UiUtils ui); @SharedAction List<SimpleObject> getSeenPatients(@RequestParam("date") Date date, UiUtils ui); @AppAction(EmrConstants.APP_CHART) SimpleObject[] recentlyViewed(UiUtils ui, Session session); SimpleObject age(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now); SimpleObject[] getMothers(@RequestParam("patientId") Patient patient,UiUtils ui); SimpleObject[] getFathers(@RequestParam("patientId") Patient patient,UiUtils ui); String patientExist(@RequestParam("patientId") String patientId,UiUtils ui);  }
@Test public void getFathers_shouldReturnAllFathersOfPatient() { Patient parent = TestUtils.getPatient(6); Patient child = TestUtils.getPatient(2); TestUtils.saveRelationship(parent, Context.getPersonService().getRelationshipType(2), child); SimpleObject[] fathers = controller.getFathers(child, ui); Assert.assertThat(fathers, arrayWithSize(1)); Assert.assertThat(fathers[0], hasEntry("id", (Object) (6))); }