use of org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback 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"));
}
use of org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback in project pentaho-platform by pentaho.
the class ActionHarnessTest method testSetValueFailedConvertWitNonNullValue.
@Test(expected = Exception.class)
public void testSetValueFailedConvertWitNonNullValue() throws Exception {
TestAction action1 = new TestAction();
ActionHarness harness1 = new ActionHarness(action1);
harness1.setValue("count", new CustomParamType(), new EagerFailingCallback());
}
use of org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback in project pentaho-platform by pentaho.
the class ActionHarnessTest method testSetNullIsSkippedWithNotError.
@Test
public void testSetNullIsSkippedWithNotError() throws Exception {
TestAction action1 = new TestAction();
ActionHarness harness1 = new ActionHarness(action1);
// commons bBeanutils will throw exception if you try to type convert a null value. Pentaho BeanUtil
// will skip the set operation altogether if you try to set a null value on a bean. This test ensures
// that no exception is thrown in this case. The correct behavior is a message will be logged indicating
// that the null value could not be set. I don't consider this a "real" type conversion problem like
// a text string failing conversion to a Long type.. this type of conversion will still fail.
harness1.setValue("count", null, new EagerFailingCallback());
// If no exception thrown, then the test is essentially passed. We'll double check that
// count was not set as well.
Assert.assertNull("count property should remain null since null set value ops should be skipped", action1.getCount());
}
use of org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback in project pentaho-platform by pentaho.
the class ActionHarnessTest method testSetValueNonExistentProperty.
@Test(expected = IllegalAccessException.class)
public void testSetValueNonExistentProperty() throws Exception {
TestAction action1 = new TestAction();
ActionHarness harness1 = new ActionHarness(action1);
harness1.setValue("THISPROPERTYDOESNOTEXIST", "", new EagerFailingCallback());
Assert.assertEquals("test message action1", harness1.getValue("message"));
}
use of org.pentaho.platform.util.beans.BeanUtil.EagerFailingCallback 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);
}
Aggregations