Skip to content

Commit 7fcee6f

Browse files
authored
MINOR: transformValues test improvement (apache#19106)
Follow-up to 295760d. Also check the set of state stores as suggested in reviews. Reviewers: Bruno Cadonna <[email protected]>
1 parent b89c819 commit 7fcee6f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

streams/src/test/java/org/apache/kafka/streams/kstream/internals/KTableTransformValuesTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import java.util.Arrays;
6363
import java.util.List;
6464
import java.util.Properties;
65+
import java.util.Set;
6566

6667
import static org.hamcrest.CoreMatchers.equalTo;
6768
import static org.hamcrest.CoreMatchers.hasItems;
@@ -410,6 +411,8 @@ public void shouldCalculateCorrectOldValuesIfMaterializedEvenIfStateful() {
410411

411412
final KeyValueStore<String, Integer> keyValueStore = driver.getKeyValueStore(QUERYABLE_NAME);
412413
assertThat(keyValueStore.get("A"), is(3));
414+
assertThat(driver.getAllStateStores().keySet(),
415+
equalTo(Set.of(QUERYABLE_NAME, "KTABLE-AGGREGATE-STATE-STORE-0000000005")));
413416
}
414417

415418
@Test
@@ -434,6 +437,8 @@ public void shouldCalculateCorrectOldValuesIfNotStatefulEvenIfNotMaterialized()
434437
assertThat(output(), equalTo(Arrays.asList(new KeyValueTimestamp<>("A", "1", 5),
435438
new KeyValueTimestamp<>("A", "2", 15),
436439
new KeyValueTimestamp<>("A", "3", 15))));
440+
assertThat(driver.getAllStateStores().keySet(),
441+
equalTo(Set.of("inputTopic-STATE-STORE-0000000000", "KTABLE-AGGREGATE-STATE-STORE-0000000005")));
437442
}
438443

439444
@Test
@@ -460,6 +465,8 @@ public void shouldCalculateCorrectOldValuesIfNotStatefulEvenNotMaterializedNoQue
460465
assertThat(output(), equalTo(Arrays.asList(new KeyValueTimestamp<>("A", "1", 5),
461466
new KeyValueTimestamp<>("A", "2", 15),
462467
new KeyValueTimestamp<>("A", "3", 15))));
468+
assertThat(driver.getAllStateStores().keySet(),
469+
equalTo(Set.of("inputTopic-STATE-STORE-0000000000", "KTABLE-AGGREGATE-STATE-STORE-0000000005")));
463470
}
464471

465472
private ArrayList<KeyValueTimestamp<String, String>> output() {

0 commit comments

Comments
 (0)