Version des Rest-Producers, der direkt Requests für den Sumup-Adder sendet
[demos/kafka/training] / src / test / java / de / juplo / kafka / ApplicationTests.java
index 646a335..b9c1e17 100644 (file)
@@ -8,6 +8,7 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.TestConfiguration;
 import org.springframework.context.annotation.Bean;
+import org.springframework.http.MediaType;
 import org.springframework.kafka.annotation.KafkaListener;
 import org.springframework.kafka.test.context.EmbeddedKafka;
 import org.springframework.test.web.servlet.MockMvc;
@@ -53,11 +54,15 @@ public class ApplicationTests
        void testSendMessage() throws Exception
        {
                mockMvc
-                               .perform(post("/peter").content("Hallo Welt!"))
+                               .perform(
+                                               post("/peter")
+                                                               .header("X-id", 7)
+                                                               .contentType(MediaType.APPLICATION_JSON)
+                                                               .content("666"))
                                .andExpect(status().isOk());
                await("Message was send")
                                .atMost(Duration.ofSeconds(5))
-                               .until(() -> consumer.received.size() == 1);
+                               .until(() -> consumer.received.size() == 667);
        }