BenefitTypeParametersExtractor extends AbstractParametersExtractor<BenefitType> { @Override protected Map<String, Object> getParameters(final BenefitType entity, final Map<String, Object> parameters) { addParameter(entity.getName(), "name", parameters); addParameter(entity.getPriority(), "priority", parameters); return parameters; }    }
@Test public void testGetParameters() throws Exception { String name = "name1"; Integer priority = 5; BenefitType entity = new BenefitType(); entity.setName(name); entity.setPriority(priority); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("name", name); expected.put("priority", priority); 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 name = "name1"; Integer priority = 5; BenefitType entity = new BenefitType(); entity.setName(name); entity.setPriority(priority); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("name", name); expected.put("priority", priority); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDefaultEntity() throws Exception { BenefitType entity = new BenefitType(); 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); BenefitType entity = new BenefitType(); 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); BenefitType entity = new BenefitType(); 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); BenefitType entity = new BenefitType(); Map<String, Object> expected = new HashMap<String, Object>(); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }