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;
"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
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())