@Test(expectedExceptions = IllegalArgumentException.class) public void shouldFailIfFieldNotSet() throws Exception { AddSuffixAction action = new AddSuffixAction(); action.setSuffix("57"); action.execute(new Message()); }
@Test public void shouldAddSuffixIfFieldDoesntExists() throws Exception { AddSuffixAction action = new AddSuffixAction(); action.setField("to"); action.setSuffix("suf"); Message message = new Message(); action.execute(message); Assert.assertEquals(message.getProperty("to", String.class), "suf"); }