use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.
the class RangeTokensTest method testConvertNotEqualRangeToken.
@Test
public void testConvertNotEqualRangeToken() {
Text key = TestData.getText();
Operator operator = Operator.NOT_EQUALS;
Value value = TestData.getValue();
RangeToken token = RangeToken.forReading(key, operator, value);
Iterable<Range<Value>> ranges = RangeTokens.convertToRange(token);
Assert.assertEquals(Lists.newArrayList(Range.lessThan(value), Range.greaterThan(value)), ranges);
}
use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.
the class RangeTokensTest method testConvertGreaterThanOrEqualsRangeToken.
@Test
public void testConvertGreaterThanOrEqualsRangeToken() {
Text key = TestData.getText();
Operator operator = Operator.GREATER_THAN_OR_EQUALS;
Value value = TestData.getValue();
RangeToken token = RangeToken.forReading(key, operator, value);
Range<Value> range = Iterables.getOnlyElement(RangeTokens.convertToRange(token));
Assert.assertEquals(range, Range.atLeast(value));
}
use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.
the class RangeTokensTest method testConvertLessThanRangeToken.
@Test
public void testConvertLessThanRangeToken() {
Text key = TestData.getText();
Operator operator = Operator.LESS_THAN;
Value value = TestData.getValue();
RangeToken token = RangeToken.forReading(key, operator, value);
Range<Value> range = Iterables.getOnlyElement(RangeTokens.convertToRange(token));
Assert.assertEquals(range, Range.lessThan(value));
}
use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.
the class RangeTokensTest method testConvertGreaterThanRangeToken.
@Test
public void testConvertGreaterThanRangeToken() {
Text key = TestData.getText();
Operator operator = Operator.GREATER_THAN;
Value value = TestData.getValue();
RangeToken token = RangeToken.forReading(key, operator, value);
Range<Value> range = Iterables.getOnlyElement(RangeTokens.convertToRange(token));
Assert.assertEquals(range, Range.greaterThan(value));
}
use of com.cinchapi.concourse.server.model.Value in project concourse by cinchapi.
the class RangeTokensTest method testConvertBetweenRangeToken.
@Test
public void testConvertBetweenRangeToken() {
Text key = TestData.getText();
Operator operator = Operator.BETWEEN;
Value value1 = TestData.getValue();
Value value2 = null;
while (value2 == null || value1.equals(value2)) {
value2 = TestData.getValue();
}
RangeToken token = RangeToken.forReading(key, operator, value1.compareTo(value2) < 0 ? value1 : value2, value1.compareTo(value2) > 0 ? value1 : value2);
Range<Value> range = Iterables.getOnlyElement(RangeTokens.convertToRange(token));
Assert.assertEquals(range, Range.closedOpen(value1.compareTo(value2) < 0 ? value1 : value2, value1.compareTo(value2) > 0 ? value1 : value2));
}
Aggregations