PersonParametersExtractor extends AbstractParametersExtractor<PersonList> { @Override public Map<String, Object> getParameters(final PersonList entity, final Map<String, Object> parameters) { addParameter(entity.getPersonTypes(), personTypeDao, "personTypes", parameters); addParameter(entity.getGenderTypes(), genderTypeDao, "genderTypes", parameters); addParameter(entity.getMarriedTypes(), marrieTypeDao, "marriedTypes", parameters); addParameter(entity.getParents(), personDao, "parents", parameters); addParameter(entity.getCitizenCountries(), adminUnitDao, "citizenCountries", parameters); addParameter(entity.getResident(), "resident", parameters); addParameter(entity.getBegDate(), "begDate", parameters); addParameter(entity.getEndDate(), "endDate", parameters); addParameter(entity.getIsMilitary(), "isMilitary", parameters); addParameter(entity.getIsHostel(), "isHostel", parameters); return parameters; }  @Override Map<String, Object> getParameters(final PersonList entity, final Map<String, Object> parameters);  }
@Test public void testGetParameters() throws Exception { PersonList entity = new PersonList(); Map<String, Object> expected = new HashMap<>(); expected.put("status", RowStatus.ACTIVE); expected.put("userGroups", groups); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithAllFields() throws Exception { Date begDate = new Date(); Date endDate = new Date(); PersonList entity = new PersonList(); entity.setBegDate(begDate); entity.setEndDate(endDate); Map<String, Object> expected = new HashMap<>(); expected.put("status", RowStatus.ACTIVE); expected.put("userGroups", groups); expected.put("begDate", begDate); expected.put("endDate", endDate); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }