StreetTypeParametersExtractor extends AbstractParametersExtractor<StreetType> { @Override public Map<String, Object> getParameters(final StreetType entity, final Map<String, Object> parameters) { addParameter(entity.getName(), "name", parameters); addParameter(entity.getAbbrName(), "abbrName", parameters); return parameters; }  @Override Map<String, Object> getParameters(final StreetType entity, final Map<String, Object> parameters);  }
@Test public void testGetParameters() throws Exception { String name = "Extract Me All"; String abbrName = "EML"; StreetType entity = new StreetType(); entity.setName(name); entity.setAbbrName(abbrName); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("name", name); expected.put("abbrName", abbrName); expected.put("status", RowStatus.ACTIVE); expected.put("userGroups", groups); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDisabledSecurity() throws Exception { unit.setSecurity(false); String name = "Extract Me All"; String abbrName = "EML"; StreetType entity = new StreetType(); entity.setName(name); entity.setAbbrName(abbrName); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("name", name); expected.put("abbrName", abbrName); expected.put("status", RowStatus.ACTIVE); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDisabledStatus() throws Exception { unit.setActive(false); String name = "Extract Me All"; String abbrName = "EML"; StreetType entity = new StreetType(); entity.setName(name); entity.setAbbrName(abbrName); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("name", name); expected.put("abbrName", abbrName); expected.put("userGroups", groups); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDisabledDefaults() throws Exception { unit.setActive(false); unit.setSecurity(false); String name = "Extract Me All"; String abbrName = "EML"; StreetType entity = new StreetType(); entity.setName(name); entity.setAbbrName(abbrName); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("name", name); expected.put("abbrName", abbrName); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDefaultEntity() throws Exception { StreetType entity = new StreetType(); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("status", RowStatus.ACTIVE); expected.put("userGroups", groups); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDefaultEntityAndDisabledDefaults() throws Exception { unit.setActive(false); unit.setSecurity(false); StreetType entity = new StreetType(); Map<String, Object> expected = new HashMap<String, Object>(); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }