}
@Test
public void testExecuteCompareConditionListOfQueryElementStringListOfQueryElementStringBaseConditionType()
{
Rule rule1 = RuleModelFactory.eINSTANCE.createRule();
accessLayer.addElement(project, rule1);
Rule rule2 = RuleModelFactory.eINSTANCE.createRule();
accessLayer.addElement(project, rule2);
List<EObject> l1 = new ArrayList<EObject>();
l1.add(rule1);
List<EObject> l2 = new ArrayList<EObject>();
l2.add(rule2);
rule1.setRuleID("test");
rule2.setRuleID("test");
List<List<EObject>> results = new ArrayList<List<EObject>>();
results.add(l1);
results.add(l2);
List<EObject[]> tuples = new ArrayList<EObject[]>();
// test "EQUALS":
assertEquals(1, l1.size());
assertEquals(1, l2.size());
assertTrue(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_EQUALS, tuples));
assertEquals(1, l1.size());
assertEquals(1, l2.size());
rule1.setRuleID("test__");
assertFalse(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_EQUALS, tuples));
assertEquals(0, l1.size());
assertEquals(0, l2.size());
l1.add(rule1);
l2.add(rule2);
// test "STARTS_WITH":
assertEquals(1, l1.size());
assertEquals(1, l2.size());
assertTrue(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_STARTS_WITH, tuples));
assertEquals(1, l1.size());
assertEquals(1, l2.size());
rule1.setRuleID("_test");
assertFalse(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_STARTS_WITH, tuples));
assertEquals(0, l1.size());
assertEquals(0, l2.size());
l1.add(rule1);
l2.add(rule2);
// test "ENDS_WITH":
assertEquals(1, l1.size());
assertEquals(1, l2.size());
assertTrue(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_ENDS_WITH, tuples));
assertEquals(1, l1.size());
assertEquals(1, l2.size());
rule1.setRuleID("test_");
assertFalse(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_ENDS_WITH, tuples));
assertEquals(0, l1.size());
assertEquals(0, l2.size());
l1.add(rule1);
l2.add(rule2);
// test "CONTAINS":
assertEquals(1, l1.size());
assertEquals(1, l2.size());
assertTrue(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_CONTAINS, tuples));
assertEquals(1, l1.size());
assertEquals(1, l2.size());
rule1.setRuleID("tes");
assertFalse(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_CONTAINS, tuples));
assertEquals(0, l1.size());
assertEquals(0, l2.size());
l1.add(rule1);
l2.add(rule2);
// test "LESSER_THAN":
rule1.setRuleID("1");
rule2.setRuleID("2");
assertEquals(1, l1.size());
assertEquals(1, l2.size());
assertTrue(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_LESSER_THAN, tuples));
assertEquals(1, l1.size());
assertEquals(1, l2.size());
rule1.setRuleID("2");
assertFalse(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_LESSER_THAN, tuples));
assertEquals(0, l1.size());
assertEquals(0, l2.size());
l1.add(rule1);
l2.add(rule2);
rule1.setRuleID("no_number"); // test if the input ain't a number
assertFalse(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_LESSER_THAN, tuples));
assertEquals(0, l1.size());
assertEquals(0, l2.size());
l1.add(rule1);
l2.add(rule2);
// test "GREATER_THAN":
rule1.setRuleID("2");
rule2.setRuleID("1");
assertEquals(1, l1.size());
assertEquals(1, l2.size());
assertTrue(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_GREATER_THAN, tuples));
assertEquals(1, l1.size());
assertEquals(1, l2.size());
rule2.setRuleID("2");
assertFalse(conditionProcessor.executeCompareCondition(l1, "RuleID", l2, "RuleID", BaseConditionType.VALUE_GREATER_THAN, tuples));
assertEquals(0, l1.size());
assertEquals(0, l2.size());
l1.add(rule1);
l2.add(rule2);