コード例 #1
0
  @Test(expectedExceptions = IllegalArgumentException.class)
  public void shouldFailIfFieldNotSet() throws Exception {

    AddSuffixAction action = new AddSuffixAction();
    action.setSuffix("57");

    action.execute(new Message());
  }
コード例 #2
0
  @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");
  }