Skip to content

Commit

Permalink
Improve test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
nmayorsplit committed Oct 23, 2023
1 parent 7c28a58 commit 47cff5b
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions client/src/test/java/io/split/client/SplitClientConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ public void testImpressionRefreshRateConstraints() {

@Test
public void setImpressionRefreshRateWorks() {
SplitClientConfig.builder()
.impressionsRefreshRate(1)
SplitClientConfig config = SplitClientConfig.builder()
.impressionsRefreshRate(65)
.build();
Assert.assertEquals(65, config.impressionsRefreshRate());
}

@Test(expected = IllegalArgumentException.class)
Expand All @@ -92,26 +93,31 @@ public void cannotSetEventsFlushRateToEqualTo1000() {

@Test
public void eventsFlushRateWorks() {
SplitClientConfig.builder()
SplitClientConfig config = SplitClientConfig.builder()
.eventFlushIntervalInMillis(1000)
.build();
Assert.assertEquals(1000, config.eventSendIntervalInMillis());
}

@Test(expected = IllegalArgumentException.class)
public void cannotSetMetricsRefreshRateToLessTha30() {
public void cannotSetMetricsRefreshRateToLessThan30() {
SplitClientConfig.builder()
.metricsRefreshRate(29)
.build();
}

@Test
public void canSetRefreshRatesTo30() {
SplitClientConfig.builder()
SplitClientConfig cfg = SplitClientConfig.builder()
.featuresRefreshRate(30)
.segmentsRefreshRate(30)
.impressionsRefreshRate(30)
.metricsRefreshRate(30)
.impressionsRefreshRate(65)
.metricsRefreshRate(65)
.build();
Assert.assertEquals(30, cfg.featuresRefreshRate());
Assert.assertEquals(30, cfg.segmentsRefreshRate());
Assert.assertEquals(65, cfg.impressionsRefreshRate());
Assert.assertEquals(65, cfg.metricsRefreshRate());
}

@Test
Expand Down Expand Up @@ -175,6 +181,7 @@ public void streamingReconnectBackoffBaseAllowed() {
SplitClientConfig cfg = SplitClientConfig.builder()
.streamingReconnectBackoffBase(1)
.build();
Assert.assertEquals(1, cfg.streamingReconnectBackoffBase());
}

@Test
Expand Down

0 comments on commit 47cff5b

Please sign in to comment.