Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobEdding committed Apr 11, 2024
1 parent 7461741 commit 011347e
Show file tree
Hide file tree
Showing 3 changed files with 180 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,64 @@ public void shouldBeDoneAfterSingleWord() {
public void shouldDoNothingOnEmptyInput() {
this.testTopology.streamOutput().expectNoMoreRecord().and().expectNoMoreRecord().toBeEmpty();
}

@Test
public void shouldConvertStreamOutputToList() {
this.testTopology.input()
.add("bla")
.add("blub")
.add("bla");

final List<ProducerRecord<String, Long>> outputs = this.testTopology.streamOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.extracting(ProducerRecord::key)
.containsExactly("bla", "blub", "bla");
assertThat(outputs)
.extracting(ProducerRecord::value)
.containsExactly(1L, 1L, 2L);
}

@Test
public void shouldConvertTableOutputToList() {
this.testTopology.input()
.add("bla")
.add("blub")
.add("bla");

final List<ProducerRecord<String, Long>> outputs = this.testTopology.tableOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.extracting(ProducerRecord::key)
.containsExactly("bla", "blub");
assertThat(outputs)
.extracting(ProducerRecord::value)
.containsExactly(2L, 1L);
}

@Test
public void shouldConvertEmptyStreamOutputToEmptyList() {
final List<ProducerRecord<String, Long>> outputs = this.testTopology.streamOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.isInstanceOf(List.class)
.isEmpty();
}

@Test
public void shouldConvertEmptyTableOutputToEmptyList() {
final List<ProducerRecord<String, Long>> outputs = this.testTopology.tableOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.isInstanceOf(List.class)
.isEmpty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,64 @@ void shouldBeDoneAfterSingleWord() {
void shouldDoNothingOnEmptyInput() {
this.testTopology.streamOutput().expectNoMoreRecord().and().expectNoMoreRecord().toBeEmpty();
}

@Test
void shouldConvertStreamOutputToList() {
this.testTopology.input()
.add("bla")
.add("blub")
.add("bla");

final List<ProducerRecord<String, Long>> outputs = this.testTopology.streamOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.extracting(ProducerRecord::key)
.containsExactly("bla", "blub", "bla");
assertThat(outputs)
.extracting(ProducerRecord::value)
.containsExactly(1L, 1L, 2L);
}

@Test
void shouldConvertTableOutputToList() {
this.testTopology.input()
.add("bla")
.add("blub")
.add("bla");

final List<ProducerRecord<String, Long>> outputs = this.testTopology.tableOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.extracting(ProducerRecord::key)
.containsExactly("bla", "blub");
assertThat(outputs)
.extracting(ProducerRecord::value)
.containsExactly(2L, 1L);
}

@Test
void shouldConvertEmptyStreamOutputToEmptyList() {
final List<ProducerRecord<String, Long>> outputs = this.testTopology.streamOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.isInstanceOf(List.class)
.isEmpty();
}

@Test
void shouldConvertEmptyTableOutputToEmptyList() {
final List<ProducerRecord<String, Long>> outputs = this.testTopology.tableOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.isInstanceOf(List.class)
.isEmpty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -387,4 +387,64 @@ void shouldBeDoneAfterSingleWord() {
void shouldDoNothingOnEmptyInput() {
this.testTopology.streamOutput().expectNoMoreRecord().and().expectNoMoreRecord().toBeEmpty();
}

@Test
void shouldConvertStreamOutputToList() {
this.testTopology.input()
.add("bla")
.add("blub")
.add("bla");

final List<ProducerRecord<String, Long>> outputs = this.testTopology.streamOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.extracting(ProducerRecord::key)
.containsExactly("bla", "blub", "bla");
assertThat(outputs)
.extracting(ProducerRecord::value)
.containsExactly(1L, 1L, 2L);
}

@Test
void shouldConvertTableOutputToList() {
this.testTopology.input()
.add("bla")
.add("blub")
.add("bla");

final List<ProducerRecord<String, Long>> outputs = this.testTopology.tableOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.extracting(ProducerRecord::key)
.containsExactly("bla", "blub");
assertThat(outputs)
.extracting(ProducerRecord::value)
.containsExactly(2L, 1L);
}

@Test
void shouldConvertEmptyStreamOutputToEmptyList() {
final List<ProducerRecord<String, Long>> outputs = this.testTopology.streamOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.isInstanceOf(List.class)
.isEmpty();
}

@Test
void shouldConvertEmptyTableOutputToEmptyList() {
final List<ProducerRecord<String, Long>> outputs = this.testTopology.tableOutput()
.withSerde(Serdes.String(), Serdes.Long())
.toList();

assertThat(outputs)
.isInstanceOf(List.class)
.isEmpty();
}
}

0 comments on commit 011347e

Please sign in to comment.