Search in sources :

Example 1 with PropertyNameFormatter

use of org.pentaho.platform.util.beans.PropertyNameFormatter in project pentaho-platform by pentaho.

the class ActionHarnessTest method testSetValueWithFormatter.

@Test
public void testSetValueWithFormatter() throws Exception {
    TestAction action1 = new TestAction();
    ActionHarness harness1 = new ActionHarness(action1);
    PropertyNameFormatter f = new PropertyNameFormatter() {

        public String format(String name) {
            return "message";
        }
    };
    harness1.setValue("THISWILLGETCLOBBERED", "test message action1", new EagerFailingCallback(), f);
    Assert.assertEquals("test message action1", harness1.getValue("message"));
}
Also used : PropertyNameFormatter(org.pentaho.platform.util.beans.PropertyNameFormatter) ActionHarness(org.pentaho.platform.util.beans.ActionHarness) EagerFailingCallback(org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback) Test(org.junit.Test)

Example 2 with PropertyNameFormatter

use of org.pentaho.platform.util.beans.PropertyNameFormatter in project pentaho-platform by pentaho.

the class ActionHarnessTest method testSetValueWithFormatterNonExistentProperty.

@Test(expected = IllegalAccessException.class)
public void testSetValueWithFormatterNonExistentProperty() throws Exception {
    TestAction action1 = new TestAction();
    ActionHarness harness1 = new ActionHarness(action1);
    PropertyNameFormatter f = new PropertyNameFormatter() {

        public String format(String name) {
            return "THISPROPERTYDOESNOTEXIST";
        }
    };
    harness1.setValue("THISWILLGETCLOBBERED", "test message action1", new EagerFailingCallback(), f);
}
Also used : PropertyNameFormatter(org.pentaho.platform.util.beans.PropertyNameFormatter) ActionHarness(org.pentaho.platform.util.beans.ActionHarness) EagerFailingCallback(org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ActionHarness (org.pentaho.platform.util.beans.ActionHarness)2 EagerFailingCallback (org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback)2 PropertyNameFormatter (org.pentaho.platform.util.beans.PropertyNameFormatter)2