use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testAndOperatorPrecedenceBoth.
/**
* Tests for correct operator precedence when there are ANDs on both sides of the OR: a {@literal &}{@literal &} b
* || c {@literal &}{@literal &} d.
*/
@Test
public void testAndOperatorPrecedenceBoth() {
builder.equals(new WTextField(), "1").and().equals(new WTextArea(), "2").or().equals(new WDropdown(), "3").and().equals(new WMultiSelect(), "4");
Assert.assertEquals("Incorrect condition", "((WTextField=\"1\" and WTextArea=\"2\") or (WDropdown=\"3\" and WMultiSelect=\"4\"))", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testAndandOrWithExpressions.
/**
* Tests nesting of expression builders to change the order of operations: (a {@literal &}{@literal &} b) || (c
* {@literal &}{@literal &} d).
*/
@Test
public void testAndandOrWithExpressions() {
builder.equals(new WTextField(), "1").and(new ExpressionBuilder().equals(new WTextArea(), "2")).or(new ExpressionBuilder().equals(new WDropdown(), "3")).and().equals(new WMultiSelect(), "4");
Assert.assertEquals("Incorrect condition", "((WTextField=\"1\" and WTextArea=\"2\") or (WDropdown=\"3\" and WMultiSelect=\"4\"))", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testNesting.
/**
* Tests nesting of expression builders to change the order of operations: (a {@literal &}{@literal &} (b || c)
* {@literal &}{@literal &} d).
*/
@Test
public void testNesting() {
builder.equals(new WTextField(), "1").and(new ExpressionBuilder().equals(new WTextArea(), "2").or().equals(new WDropdown(), "3")).and().equals(new WMultiSelect(), "4");
Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" and (WTextArea=\"2\" or WDropdown=\"3\") and WMultiSelect=\"4\")", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testBuildMatches.
@Test
public void testBuildMatches() {
builder.matches(new WTextField(), "1");
Assert.assertEquals("Incorrect condition", "WTextField matches \"1\"", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testValidate.
@Test
public void testValidate() {
Assert.assertFalse("An empty expression should not be valid", builder.validate());
builder.equals(new WTextField(), "1");
Assert.assertTrue("A valid expression should be valid", builder.validate());
}
Aggregations