use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testBuildEquals.
@Test
public void testBuildEquals() {
builder.equals(new WTextField(), "1");
Assert.assertEquals("Incorrect condition", "WTextField=\"1\"", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testTwoArgOrCondition.
@Test
public void testTwoArgOrCondition() {
builder.equals(new WTextField(), "1").or().equals(new WTextArea(), "2");
Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" or WTextArea=\"2\")", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testTwoArgAndCondition.
@Test
public void testTwoArgAndCondition() {
builder.equals(new WTextField(), "1").and().equals(new WTextArea(), "2");
Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" and WTextArea=\"2\")", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testOrOperatorPrecedenceBoth.
/**
* Tests for correct operator precedence when there are ANDs on both sides of the OR: a || b
* {@literal &}{@literal &} c || d.
*/
@Test
public void testOrOperatorPrecedenceBoth() {
builder.equals(new WTextField(), "1").or().equals(new WTextArea(), "2").and().equals(new WDropdown(), "3").or().equals(new WMultiSelect(), "4");
Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" or ((WTextArea=\"2\" and WDropdown=\"3\") or WMultiSelect=\"4\"))", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.
the class GroupExpression_Test method testBuildOr.
@Test
public void testBuildOr() {
GroupExpression expr = new GroupExpression(GroupExpression.Type.OR);
BooleanExpression operand1 = new CompareExpression(CompareType.EQUAL, new WTextField(), "1");
BooleanExpression operand2 = new CompareExpression(CompareType.EQUAL, new WTextField(), "2");
BooleanExpression operand3 = new CompareExpression(CompareType.EQUAL, new WTextField(), "3");
expr.add(operand1);
expr.add(operand2);
expr.add(operand3);
Or condition = (Or) expr.build();
Assert.assertEquals("Incorrect 1st operand for OR", operand1.build().toString(), condition.getConditions().get(0).toString());
Assert.assertEquals("Incorrect 2nd operand for OR", operand2.build().toString(), condition.getConditions().get(1).toString());
Assert.assertEquals("Incorrect 3rd operand for OR", operand3.build().toString(), condition.getConditions().get(2).toString());
}
Aggregations