use of com.github.bordertech.wcomponents.Disableable in project wcomponents by BorderTech.
the class AbstractSetEnable_Test method testExecute.
@Test
public void testExecute() {
// Valid Disableable Target and FALSE Boolean Value
SubordinateTarget target = new MyTarget();
AbstractSetEnable enable = new MyEnable(target, Boolean.FALSE);
// Should be disabled
enable.execute();
Assert.assertTrue("Target should be disabled", ((Disableable) target).isDisabled());
// Should be not validate
Assert.assertFalse("Target should not be validate", target.isValidate());
// Valid Disableable Target and TRUE Boolean Value
target = new MyTarget();
enable = new MyEnable(target, Boolean.TRUE);
((Disableable) target).setDisabled(true);
// Should be enabled
enable.execute();
Assert.assertFalse("Target should be enabled", ((Disableable) target).isDisabled());
// Should be validate
Assert.assertTrue("Target should be validate", target.isValidate());
// Invalid Target (Not Disableable)
target = new MyInvalidTarget();
enable = new MyEnable(target, Boolean.FALSE);
// Nothing happen to target
enable.execute();
}
Aggregations