Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import org.springframework.kafka.test.context.EmbeddedKafka;
import org.springframework.kafka.test.utils.KafkaTestUtils;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;

/**
* @author Gary Russell
* @author Ngoc Nhan
* @since 2.2
*
*/
Expand All @@ -55,14 +55,8 @@ public void testMissingTopicCMLC() {
ConcurrentMessageListenerContainer<Integer, String> container =
new ConcurrentMessageListenerContainer<>(cf, containerProps);
container.setBeanName("testMissing1");

try {
container.start();
fail("Expected exception");
}
catch (IllegalStateException e) {
assertThat(e.getMessage()).contains("missingTopicsFatal");
}
assertThatIllegalStateException().isThrownBy(container::start)
.withMessageContaining("missingTopicsFatal");
}

@Test
Expand All @@ -75,13 +69,8 @@ public void testMissingTopicKMLC() {
KafkaMessageListenerContainer<Integer, String> container =
new KafkaMessageListenerContainer<>(cf, containerProps);
container.setBeanName("testMissing2");
try {
container.start();
fail("Expected exception");
}
catch (IllegalStateException e) {
assertThat(e.getMessage()).contains("missingTopicsFatal");
}
assertThatIllegalStateException().isThrownBy(container::start)
.withMessageContaining("missingTopicsFatal");
container.getContainerProperties().setMissingTopicsFatal(false);
container.start();
container.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

Expand Down Expand Up @@ -103,6 +102,7 @@
* @author Nathan Xu
* @author Soby Chacko
* @author Mikhail Polivakha
* @author Ngoc Nhan
* @since 2.1.3
*
*/
Expand Down Expand Up @@ -903,19 +903,8 @@ void requestTimeoutWithMessage() throws Exception {
CompletableFuture future = template.sendAndReceive(msg, Duration.ofMillis(10),
new ParameterizedTypeReference<Foo>() {
});
try {
future.get(10, TimeUnit.SECONDS);
}
catch (TimeoutException ex) {
fail("get timed out");
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
fail("Interrupted");
}
catch (ExecutionException e) {
assertThat(System.currentTimeMillis() - t1).isLessThan(3000L);
}
assertThatExceptionOfType(ExecutionException.class).isThrownBy(() -> future.get(10, TimeUnit.SECONDS));
assertThat(System.currentTimeMillis() - t1).isLessThan(3000L);
}

@Test
Expand Down