All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.server.springboot.broker.kafka.SampleConsumerIT.mustache Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package {{packageName}}.sample.infrastructure.primary.kafka.consumer;

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

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import {{packageName}}.IntegrationTest;
import {{packageName}}.sample.infrastructure.secondary.kafka.producer.SampleProducer;

@IntegrationTest
class SampleConsumerIT {

  @Autowired
  private SampleProducer sampleProducer;

  @Autowired
  private SampleConsumer sampleConsumer;

  @Test
  void shouldHandleMessage() {
    final String messageToSend = "sample";
    sampleProducer.send(messageToSend);

    ConsumerRecord record = new ConsumerRecord<>("queue.kafkaapp.sample", 0, 0, null, messageToSend);
    boolean actualResult = sampleConsumer.handleMessage(record);

    assertThat(actualResult).isTrue();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy