Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@RunWith(MockitoJUnitRunner.class)
public class RabbitMqConfigurationTest {
@InjectMocks
private RabbitMqConfiguration queueConfiguration;
@Test
public void it_should_get_queue() {
//Given && //When
final Queue queue = queueConfiguration.queue();
//Then
assertThat(queue.isDurable()).isTrue();
assertThat(queue.getName()).isEqualTo("queue");
assertThat(queue.getArguments()).containsEntry(X_DEAD_LETTER_EXCHANGE, "");
assertThat(queue.getArguments()).containsEntry(X_DEAD_LETTER_ROUTING_KEY, "queue.dead-letter");
}
@Test
public void it_should_get_exchange() {
//Given && //When
final TopicExchange topicExchange = queueConfiguration.exchange();
//Then
assertThat(topicExchange.getName()).isEqualTo("queue");
}
@Test
public void it_should_get_queue_dead_letter() {
//Given && //When
final Queue queue = queueConfiguration.deadLetter();
//Then
assertThat(queue.isDurable()).isTrue();
assertThat(queue.getName()).isEqualTo("queue.dead-letter");
}
@Test
public void it_should_get_binding() {
//Given && //When
final Binding binding = queueConfiguration.queueBinding();
//Then
assertThat(binding.getExchange()).isEqualTo("queue");
assertThat(binding.getDestination()).isEqualTo("queue");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment