Package org.mokai.action

Examples of org.mokai.action.ReplaceAction


public class ReplaceActionTest {

  @Test
  public void shouldReplaceStrings() throws Exception {
    ReplaceAction action = new ReplaceAction();
    action.setField("message");

    Map<String,String> replace = new HashMap<String,String>();
    replace.put("á", "a");
    replace.put("é", "e");
    replace.put("í", "nh");
    replace.put("ó", "");
    replace.put("badword", "_");
    action.setReplace(replace);

    Message message = new Message();
    message.setProperty("message", "áéíó badword");

    action.execute(message);

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


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

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void shouldFailIfFieldIsNotSet() throws Exception {
    ReplaceAction action = new ReplaceAction();
    action.execute(new Message());
  }
View Full Code Here

TOP

Related Classes of org.mokai.action.ReplaceAction

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.