BroadcastingParametersExtractor extends AbstractParametersExtractor<BroadcastingMessage> { @Override protected Map<String, Object> getParameters(final BroadcastingMessage entity, final Map<String, Object> parameters) { addParameter(entity.getTopic(), "topic", parameters); return parameters; }    }
@Test public void testGetParameters() throws Exception { String content = "content"; String topic = "topic"; BroadcastingMessage entity = new BroadcastingMessage(); entity.setContent(content); entity.setTopic(topic); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("topic", topic); 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 content = "content"; String topic = "topic"; BroadcastingMessage entity = new BroadcastingMessage(); entity.setContent(content); entity.setTopic(topic); Map<String, Object> expected = new HashMap<String, Object>(); expected.put("topic", topic); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }
@Test public void testGetParametersWithDefaultEntity() throws Exception { BroadcastingMessage entity = new BroadcastingMessage(); 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); BroadcastingMessage entity = new BroadcastingMessage(); 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); BroadcastingMessage entity = new BroadcastingMessage(); 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); BroadcastingMessage entity = new BroadcastingMessage(); Map<String, Object> expected = new HashMap<String, Object>(); Map<String, Object> actual = unit.getParameters(entity); assertEquals(expected, actual); }