Package org.mokai.action

Examples of org.mokai.action.CopyAction


public class CopyActionTest {

  @Test
  public void shouldCopyProperty() throws Exception {
    CopyAction action = new CopyAction();
    action.setFrom("prop-1");
    action.setTo("prop-2");

    Message message = new Message();
    message.setProperty("prop-1", "value");

    action.execute(message);

    Assert.assertEquals(message.getProperty("prop-1"), "value");
    Assert.assertEquals(message.getProperty("prop-2"), "value");
  }
View Full Code Here


    Assert.assertEquals(message.getProperty("prop-2"), "value");
  }

  @Test
  public void shouldCopyPropertyAndDeleteFrom() throws Exception {
    CopyAction action = new CopyAction();
    action.setFrom("prop-1");
    action.setTo("prop-2");
    action.setDeleteFrom(true);

    Message message = new Message();
    message.setProperty("prop-1", "value");

    action.execute(message);

    Assert.assertNull(message.getProperty("prop-1"));
    Assert.assertEquals(message.getProperty("prop-2"), "value");
  }
View Full Code Here

    Assert.assertEquals(message.getProperty("prop-2"), "value");
  }

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void shouldThrowExceptionIfFromNotSet() throws Exception {
    CopyAction action = new CopyAction();
    action.setFrom("prop-2");

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

    action.execute(new Message());
  }

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void shouldThrowExceptionIfToNotSet() throws Exception {
    CopyAction action = new CopyAction();
    action.setTo("prop-2");

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

TOP

Related Classes of org.mokai.action.CopyAction

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.