BenefitParametersExtractor extends AbstractParametersExtractor<Benefit> { @Override protected Map<String, Object> getParameters(final Benefit entity, final Map<String, Object> parameters) { addParameter(entity.getBenefitType(), benefitTypeDao, "benefitType", parameters); addParameter(entity.getParent(), benefitDao, "parent", parameters); addParameter(entity.getName(), "name", parameters); addParameter(entity.getAbbrName(), "abbrName", parameters); addParameter(entity.getBegDate(), "begDate", parameters); addParameter(entity.getEndDate(), "endDate", parameters); addParameter(entity.getDescription(), "description", parameters); return parameters; }    }
@Test public void testGetParameters() throws Exception { String abbrName = "abbrName"; Benefit entity = new Benefit(); entity.setAbbrName(abbrName); Map<String, Object> expected = new HashMap<String, Object>(); 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 testGetParametersWithDisabledDefaults() throws Exception { unit.setActive(false); unit.setSecurity(false); String abbrName = "abbrName"; Benefit entity = new Benefit(); entity.setAbbrName(abbrName); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("abbrName", abbrName); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDefaultEntity() throws Exception { Benefit entity = new Benefit(); 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 testGetParametersWithDefaultEntityAndDisabledSecurity() throws Exception { unit.setSecurity(false); Benefit entity = new Benefit(); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("status", RowStatus.ACTIVE); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDefaultEntityAndDisabledStatus() throws Exception { unit.setActive(false); Benefit entity = new Benefit(); Map<String, Object> expected = new HashMap<String, Object>(); 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); Benefit entity = new Benefit(); Map<String, Object> expected = new HashMap<String, Object>(); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }