WIP
authorKai Moritz <kai@juplo.de>
Sun, 5 May 2024 11:56:57 +0000 (13:56 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 5 May 2024 11:56:57 +0000 (13:56 +0200)
src/test/java/de/juplo/kafka/wordcount/recorder/ApplicationTests.java

index 6bb8845..0a70993 100644 (file)
@@ -2,8 +2,10 @@ package de.juplo.kafka.wordcount.recorder;
 
 import lombok.extern.slf4j.Slf4j;
 import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.junit.jupiter.api.DisplayName;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.TestConfiguration;
 import org.springframework.context.annotation.Bean;
@@ -27,6 +29,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
                                "spring.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}",
                                "juplo.wordcount.recorder.bootstrap-server=${spring.embedded.kafka.brokers}",
                                "juplo.wordcount.recorder.topic=" + TOPIC_OUT })
+@AutoConfigureMockMvc
 @EmbeddedKafka(topics = { TOPIC_OUT }, partitions = PARTITIONS)
 @Slf4j
 class ApplicationTests
@@ -41,15 +44,16 @@ class ApplicationTests
        private MockMvc mockMvc;
 
        @Test
+       @DisplayName("The application context loads")
        void contextLoads()
        {
        }
 
        @Test
-       void userEventsAreSent()
+       void userMessagesAreExceptedAndSentToKafka() throws Exception
        {
                mockMvc
-                               .perform(post(USER)
+                               .perform(post("/{user}", USER)
                                                .contentType(MediaType.TEXT_PLAIN)
                                                .content(SENTENCE))
                                .andDo(print())