Package org.mokai.action

Examples of org.mokai.action.AddSpacesAction


public class AddSpacesActionTest {

  @Test
  public void shouldFillWithSpaces() throws Exception {
    AddSpacesAction action = new AddSpacesAction();
    action.setField("message");
    action.setLength(160);

    Message message = new Message();
    message.setProperty("message", "a");

    action.execute(message);

    Assert.assertEquals(message.getProperty("message", String.class).length(), 160);

    String compare = "a";
    for (int i=0; i < 159; i++) {
View Full Code Here


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

  @Test
  public void shouldFillWithSpacesIfFieldIsNull() throws Exception {
    AddSpacesAction action = new AddSpacesAction();
    action.setField("message");
    action.setLength(160);

    Message message = new Message();

    action.execute(message);

    Assert.assertEquals(message.getProperty("message", String.class).length(), 160);

    String compare = "";
    for (int i=0; i < 160; i++) {
View Full Code Here

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

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void shouldFailIfFieldNotSet() throws Exception {
    AddSpacesAction action = new AddSpacesAction();
    action.setLength(1);

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

    action.execute(new Message());
  }

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void shouldFailIfLengthNotPositive() throws Exception {
    AddSpacesAction action = new AddSpacesAction();
    action.setField("message");

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

TOP

Related Classes of org.mokai.action.AddSpacesAction

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.