Skip to content

Commit 534c926

Browse files
committed
Add message to test assertion
1 parent ab49e25 commit 534c926

File tree

3 files changed

+38
-13
lines changed

3 files changed

+38
-13
lines changed

Diff for: src/main/java/com/rabbitmq/stream/impl/StreamProducerBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
class StreamProducerBuilder implements ProducerBuilder {
3030

31-
static final boolean DEFAULT_DYNAMIC_BATCH =
32-
Boolean.parseBoolean(System.getProperty("rabbitmq.stream.producer.dynamic.batch", "true"));
31+
static final boolean DEFAULT_DYNAMIC_BATCH = true;
32+
// Boolean.parseBoolean(System.getProperty("rabbitmq.stream.producer.dynamic.batch", "true"));
3333

3434
private final StreamEnvironment environment;
3535

Diff for: src/test/java/com/rabbitmq/stream/impl/SuperStreamConsumerTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ void rebalancedPartitionShouldGetMessagesWhenItComesBackToOriginalConsumerInstan
330330
processing.run();
331331
})
332332
.build();
333-
waitAtMost(() -> receivedPartitions.size() == partitions.size());
333+
waitAtMost(() -> receivedPartitions.size() == partitions.size(),
334+
() -> format("Expected to receive messages from all partitions, got %s", receivedPartitions));
334335

335336
AtomicReference<String> partition = new AtomicReference<>();
336337
Consumer consumer2 =
@@ -352,7 +353,8 @@ void rebalancedPartitionShouldGetMessagesWhenItComesBackToOriginalConsumerInstan
352353
waitAtMost(() -> partition.get() != null);
353354
consumer2.close();
354355
receivedPartitions.clear();
355-
waitAtMost(() -> receivedPartitions.size() == partitions.size());
356+
waitAtMost(() -> receivedPartitions.size() == partitions.size(),
357+
() -> format("Expected to receive messages from all partitions, got %s", receivedPartitions));
356358
consumer1.close();
357359
}
358360
}

Diff for: src/test/java/com/rabbitmq/stream/impl/TestUtilsTest.java

+32-9
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,41 @@
1616

1717
import static org.assertj.core.api.Assertions.assertThat;
1818

19+
import java.util.concurrent.Executor;
1920
import org.junit.jupiter.params.ParameterizedTest;
2021
import org.junit.jupiter.params.provider.CsvSource;
2122

2223
public class TestUtilsTest {
2324

24-
@ParameterizedTest
25-
@CsvSource({
26-
"3.9.6,3.9.5,false",
27-
"3.9.6,3.9.0-alpha-stream.232,true",
28-
"3.9.6,3.9.6-alpha.28,true"
29-
})
30-
void atLeastVersion(String expectedVersion, String currentVersion, boolean expected) {
31-
assertThat(TestUtils.atLeastVersion(expectedVersion, currentVersion)).isEqualTo(expected);
32-
}
25+
@ParameterizedTest
26+
@CsvSource(
27+
{
28+
"3.9.6,3.9.5,false",
29+
"3.9.6,3.9.0-alpha-stream.232,true",
30+
"3.9.6,3.9.6-alpha.28,true",
31+
}
32+
)
33+
void atLeastVersion(
34+
String expectedVersion,
35+
String currentVersion,
36+
boolean expected
37+
) {
38+
assertThat(
39+
TestUtils.atLeastVersion(expectedVersion, currentVersion)
40+
).isEqualTo(expected);
41+
}
42+
43+
private static class DelegatingExecutor implements Executor {
44+
45+
private final Executor delegate;
46+
47+
private DelegatingExecutor(Executor delegate) {
48+
this.delegate = delegate;
49+
}
50+
51+
@Override
52+
public void execute(Runnable command) {
53+
delegate.execute(command);
54+
}
55+
}
3356
}

0 commit comments

Comments
 (0)