use of org.apache.accumulo.core.client.impl.ConditionalWriterImpl.ConditionComparator in project accumulo by apache.
the class ConditionalComparatorTest method testComparator.
@Test
public void testComparator() {
Condition c1 = new Condition("a", "b");
Condition c2 = new Condition("a", "c");
Condition c3 = new Condition("b", "c");
Condition c4 = new Condition("a", "b").setTimestamp(5);
Condition c5 = new Condition("a", "b").setTimestamp(6);
Condition c6 = new Condition("a", "b").setVisibility(new ColumnVisibility("A&B"));
Condition c7 = new Condition("a", "b").setVisibility(new ColumnVisibility("A&C"));
ConditionComparator comparator = new ConditionComparator();
Assert.assertTrue(comparator.compare(c1, c1) == 0);
Assert.assertTrue(comparator.compare(c1, c2) < 0);
Assert.assertTrue(comparator.compare(c2, c1) > 0);
Assert.assertTrue(comparator.compare(c1, c3) < 0);
Assert.assertTrue(comparator.compare(c3, c1) > 0);
Assert.assertTrue(comparator.compare(c1, c4) < 0);
Assert.assertTrue(comparator.compare(c4, c1) > 0);
Assert.assertTrue(comparator.compare(c5, c4) < 0);
Assert.assertTrue(comparator.compare(c4, c5) > 0);
Assert.assertTrue(comparator.compare(c1, c7) < 0);
Assert.assertTrue(comparator.compare(c7, c1) > 0);
Assert.assertTrue(comparator.compare(c6, c7) < 0);
Assert.assertTrue(comparator.compare(c7, c6) > 0);
}
Aggregations