Package org.mokai.action

Examples of org.mokai.action.AddPrefixAction


public class AddPrefixActionTest {

  @Test
  public void shouldAddPrefixIfNotPresent() throws Exception {
    AddPrefixAction action = new AddPrefixAction();
    action.setField("to");
    action.setPrefix("57");

    Message message = new Message();
    message.setProperty("to", "11");

    action.execute(message);

    Assert.assertEquals(message.getProperty("to", String.class), "5711");
  }
View Full Code Here


    Assert.assertEquals(message.getProperty("to", String.class), "5711");
  }

  @Test
  public void shouldAddPrefixIfFieldDoesntExists() throws Exception {
    AddPrefixAction action = new AddPrefixAction();
    action.setField("to");
    action.setPrefix("57");

    Message message = new Message();

    action.execute(message);

    Assert.assertEquals(message.getProperty("to", String.class), "57");

  }
View Full Code Here

  }

  @Test
  public void shouldNotAddPrefixIfPresent() throws Exception {
    AddPrefixAction action = new AddPrefixAction();
    action.setField("to");
    action.setPrefix("57");

    Message message = new Message();
    message.setProperty("to", "5711");

    action.execute(message);

    Assert.assertEquals(message.getProperty("to", String.class), "5711");

  }
View Full Code Here

  }

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void shouldFailIfPrefixNotSet() throws Exception {
    AddPrefixAction action = new AddPrefixAction();
    action.setField("to");

    action.execute(new Message());
  }
View Full Code Here

    action.execute(new Message());
  }

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void shouldFailIfFieldNotSet() throws Exception {
    AddPrefixAction action = new AddPrefixAction();
    action.setPrefix("57");

    action.execute(new Message());
  }
View Full Code Here

TOP

Related Classes of org.mokai.action.AddPrefixAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.