use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RangeTest method byteStringChangeStartTest.
@Test
public void byteStringChangeStartTest() {
ByteStringRange range = ByteStringRange.create(ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("z")).startOpen(ByteString.copyFromUtf8("b"));
assertThat(range.getEndBound()).isEqualTo(BoundType.OPEN);
assertThat(range.getEnd()).isEqualTo(ByteString.copyFromUtf8("z"));
assertThat(range.getStartBound()).isEqualTo(BoundType.OPEN);
assertThat(range.getStart()).isEqualTo(ByteString.copyFromUtf8("b"));
range = range.startClosed(ByteString.copyFromUtf8("c"));
assertThat(range.getStartBound()).isEqualTo(BoundType.CLOSED);
assertThat(range.getStart()).isEqualTo(ByteString.copyFromUtf8("c"));
assertThat(range.startOpen(ByteString.EMPTY).getStartBound()).isEqualTo(BoundType.UNBOUNDED);
assertThat(range.startClosed(ByteString.EMPTY).getStartBound()).isEqualTo(BoundType.UNBOUNDED);
}
use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RangeTest method byteStringChangeEndStringTest.
@Test
public void byteStringChangeEndStringTest() {
ByteStringRange range = ByteStringRange.create("a", "z").endClosed("y");
assertThat(range.getStartBound()).isEqualTo(BoundType.CLOSED);
assertThat(range.getStart()).isEqualTo(ByteString.copyFromUtf8("a"));
assertThat(range.getEndBound()).isEqualTo(BoundType.CLOSED);
assertThat(range.getEnd()).isEqualTo(ByteString.copyFromUtf8("y"));
range = range.endOpen("x");
assertThat(range.getEndBound()).isEqualTo(BoundType.OPEN);
assertThat(range.getEnd()).isEqualTo(ByteString.copyFromUtf8("x"));
assertThat(range.endOpen("").getEndBound()).isEqualTo(BoundType.UNBOUNDED);
assertThat(range.endClosed("").getEndBound()).isEqualTo(BoundType.UNBOUNDED);
}
use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RangeTest method byteStringUnboundedTest.
@Test
public void byteStringUnboundedTest() {
ByteStringRange range = ByteStringRange.unbounded();
assertThat(range.getStartBound()).isEqualTo(BoundType.UNBOUNDED);
assertThat(range.getEndBound()).isEqualTo(BoundType.UNBOUNDED);
Throwable actualError = null;
try {
range.getStart();
} catch (Throwable e) {
actualError = e;
}
assertThat(actualError).isInstanceOf(IllegalStateException.class);
try {
range.getEnd();
} catch (Throwable e) {
actualError = e;
}
assertThat(actualError).isInstanceOf(IllegalStateException.class);
}
use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RangeTest method byteStringOfTest.
@Test
public void byteStringOfTest() {
ByteStringRange range = ByteStringRange.create(ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b"));
assertThat(range.getStartBound()).isEqualTo(BoundType.CLOSED);
assertThat(range.getStart()).isEqualTo(ByteString.copyFromUtf8("a"));
assertThat(range.getEndBound()).isEqualTo(BoundType.OPEN);
assertThat(range.getEnd()).isEqualTo(ByteString.copyFromUtf8("b"));
}
use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RangeTest method byteStringChangeStartStringTest.
@Test
public void byteStringChangeStartStringTest() {
ByteStringRange range = ByteStringRange.create("a", "z").startOpen("b");
assertThat(range.getEndBound()).isEqualTo(BoundType.OPEN);
assertThat(range.getEnd()).isEqualTo(ByteString.copyFromUtf8("z"));
assertThat(range.getStartBound()).isEqualTo(BoundType.OPEN);
assertThat(range.getStart()).isEqualTo(ByteString.copyFromUtf8("b"));
range = range.startClosed("c");
assertThat(range.getStartBound()).isEqualTo(BoundType.CLOSED);
assertThat(range.getStart()).isEqualTo(ByteString.copyFromUtf8("c"));
assertThat(range.startOpen("").getStartBound()).isEqualTo(BoundType.UNBOUNDED);
assertThat(range.startClosed("").getStartBound()).isEqualTo(BoundType.UNBOUNDED);
}
Aggregations