@Value.Default default TimestampPartitioningMap<Integer> timestampToTransactionsTableSchemaVersion() { Range<Long> startOfTime = Range.atLeast(1L); return TimestampPartitioningMap.of(ImmutableRangeMap.of(startOfTime, 1)); }
@Test public void throwsIfInitialMapIsEmpty() { assertThatThrownBy(() -> TimestampPartitioningMap.of(ImmutableRangeMap.of())) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("its span does not cover precisely all timestamps"); }
@Test public void throwsIfInitialMapDoesNotCoverFullRange() { assertThatThrownBy(() -> TimestampPartitioningMap.of(ImmutableRangeMap.of(Range.atLeast(42L), 1))) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("its span does not cover precisely all timestamps"); }
@Test public void throwsIfInitialMapExceedsTimestampRange() { assertThatThrownBy(() -> TimestampPartitioningMap.of(ImmutableRangeMap.of(Range.atLeast(-42L), 1))) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("its span does not cover precisely all timestamps"); }
@Test public void throwsIfInitialMapHasGapsInRange() { assertThatThrownBy(() -> TimestampPartitioningMap.of( ImmutableRangeMap.<Long, Integer>builder() .put(Range.closed(1L, 6L), 1) .put(Range.atLeast(8L), 2) .build())) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("While the span covers all timestamps, some are missing."); }
@Value.Default default TimestampPartitioningMap<Integer> timestampToTransactionsTableSchemaVersion() { Range<Long> startOfTime = Range.atLeast(1L); return TimestampPartitioningMap.of(ImmutableRangeMap.of(startOfTime, 1)); }