MarkScaleValueParametersExtractor extends AbstractParametersExtractor<MarkScaleValue> { @Override public Map<String, Object> getParameters(final MarkScaleValue entity, final Map<String, Object> parameters) { addParameter(entity.getMarkScale(), markScaleDao, "markScale", parameters); addParameter(entity.getStrValue(), "strValue", parameters); return parameters; }  @Override Map<String, Object> getParameters(final MarkScaleValue entity, final Map<String, Object> parameters);  }
@Test public void testGetParameters() throws Exception { String strValue = "strValue"; MarkScale markScale = new MarkScale(); markScale.setId(1L); MarkScaleValue entity = new MarkScaleValue(); entity.setStrValue(strValue); entity.setMarkScale(markScale); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("strValue", strValue); expected.put("markScale", markScale); expected.put("status", RowStatus.ACTIVE); expected.put("userGroups", groups); when(markScaleDao.getEntityById(anyLong())).thenReturn(markScale); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDisabledDefaults() throws Exception { unit.setActive(false); unit.setSecurity(false); String strValue = "strValue"; MarkScale markScale = new MarkScale(); markScale.setId(1L); MarkScaleValue entity = new MarkScaleValue(); entity.setStrValue(strValue); entity.setMarkScale(markScale); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("strValue", strValue); expected.put("markScale", markScale); when(markScaleDao.getEntityById(anyLong())).thenReturn(markScale); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDefaultEntity() throws Exception { MarkScaleValue entity = new MarkScaleValue(); 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); MarkScaleValue entity = new MarkScaleValue(); 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); MarkScaleValue entity = new MarkScaleValue(); 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); MarkScaleValue entity = new MarkScaleValue(); Map<String, Object> expected = new HashMap<String, Object>(); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }