Anwendung auf den Default-ErrorHandler umgestellt
[demos/kafka/training] / src / test / java / de / juplo / kafka / GenericApplicationTests.java
index 49ddb47..66a80ad 100644 (file)
@@ -109,9 +109,9 @@ abstract class GenericApplicationTests<K, V>
                                        assertSeenOffsetsEqualCommittedOffsets(recordHandler.seenOffsets);
                                });
 
-               assertThatExceptionOfType(IllegalStateException.class)
-                               .isThrownBy(() -> endlessConsumer.exitStatus())
-                               .describedAs("Consumer should still be running");
+               assertThat(endlessConsumer.running())
+                               .describedAs("Consumer should still be running")
+                               .isTrue();
 
                endlessConsumer.stop();
                recordGenerator.assertBusinessLogic();
@@ -144,12 +144,9 @@ abstract class GenericApplicationTests<K, V>
                                .describedAs("Received not all sent events")
                                .isLessThan(numberOfGeneratedMessages);
 
-               assertThatNoException()
-                               .describedAs("Consumer should not be running")
-                               .isThrownBy(() -> endlessConsumer.exitStatus());
-               assertThat(endlessConsumer.exitStatus())
-                               .describedAs("Consumer should have exited abnormally")
-                               .containsInstanceOf(RecordDeserializationException.class);
+               assertThat(endlessConsumer.running())
+                               .describedAs("Consumer should have exited")
+                               .isFalse();
 
                recordGenerator.assertBusinessLogic();
        }
@@ -177,12 +174,9 @@ abstract class GenericApplicationTests<K, V>
 
                assertSeenOffsetsEqualCommittedOffsets(recordHandler.seenOffsets);
 
-               assertThatNoException()
+               assertThat(endlessConsumer.running())
                                .describedAs("Consumer should not be running")
-                               .isThrownBy(() -> endlessConsumer.exitStatus());
-               assertThat(endlessConsumer.exitStatus())
-                               .describedAs("Consumer should have exited abnormally")
-                               .containsInstanceOf(RuntimeException.class);
+                               .isFalse();
 
                recordGenerator.assertBusinessLogic();
        }
@@ -392,10 +386,10 @@ abstract class GenericApplicationTests<K, V>
                        return new TestRecordHandler(applicationRecordHandler);
                }
 
-    @Bean(destroyMethod = "close")
-    public org.apache.kafka.clients.consumer.Consumer<String, Message> kafkaConsumer(ConsumerFactory<String, Message> factory)
-    {
-      return factory.createConsumer();
-    }
+               @Bean(destroyMethod = "close")
+               public org.apache.kafka.clients.consumer.Consumer<String, Message> kafkaConsumer(ConsumerFactory<String, Message> factory)
+               {
+                       return factory.createConsumer();
+               }
        }
 }