CassandraCellLoadingConfig { static CassandraCellLoadingConfig of(int crossColumnLoadBatchLimit, int singleQueryLoadBatchLimit) { return ImmutableCassandraCellLoadingConfig.builder() .crossColumnLoadBatchLimit(crossColumnLoadBatchLimit) .singleQueryLoadBatchLimit(singleQueryLoadBatchLimit) .build(); }  @Value.Default int crossColumnLoadBatchLimit(); @Value.Default int singleQueryLoadBatchLimit(); @Value.Check void check();  }
@Test public void canCreateConfigWithCrossColumnBatchingDisabled() { assertThatCode(() -> CassandraCellLoadingConfig.of(1, 100)).doesNotThrowAnyException(); }
@Test public void cannotCreateConfigWithNonPositiveCrossColumnLoadBatchLimit() { assertThatThrownBy(() -> CassandraCellLoadingConfig.of(-31, 4159)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("crossColumnLoadBatchLimit should be positive"); assertThatThrownBy(() -> CassandraCellLoadingConfig.of(0, 4242)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("crossColumnLoadBatchLimit should be positive"); }
@Test public void cannotCreateConfigWithNonPositiveSingleQueryLoadBatchLimit() { assertThatThrownBy(() -> CassandraCellLoadingConfig.of(5, -24)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("singleQueryLoadBatchLimit should be positive"); assertThatThrownBy(() -> CassandraCellLoadingConfig.of(8, 0)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("singleQueryLoadBatchLimit should be positive"); assertThatThrownBy(() -> CassandraCellLoadingConfig.of(-512, -333)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("should be positive"); }
@Test public void cannotCreateConfigWithBothLimitsNonPositive() { assertThatThrownBy(() -> CassandraCellLoadingConfig.of(-512, -333)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("should be positive"); assertThatThrownBy(() -> CassandraCellLoadingConfig.of(0, 0)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("should be positive"); }
@Test public void cannotCreateConfigWhereCrossColumnBatchLimitExceedsSingleQueryLimit() { assertThatThrownBy(() -> CassandraCellLoadingConfig.of(100, 99)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("shouldn't exceed single query load batch limit"); }
@Test public void canCreateConfigWhereCrossColumnBatchLimitEqualsSingleQueryLimit() { assertThatCode(() -> CassandraCellLoadingConfig.of(777, 777)).doesNotThrowAnyException(); }