properly classifying a testclear
This commit is contained in:
parent
3f476fac7d
commit
7bae130d68
1
pom.xml
1
pom.xml
|
@ -682,6 +682,7 @@
|
|||
-->
|
||||
|
||||
<!-- group 3 - Fail, 21 min, 35 tests failed, 8,624 KB -->
|
||||
<!-- group 3 - Fail, 24 min, 34 tests failed, 9,353 KB -->
|
||||
<!-- https://rest-security.ci.cloudbees.com/job/github-projects-Jobs/job/tutorials-integration/192/ -->
|
||||
|
||||
<!-- group 4 -->
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package broadcast;
|
||||
|
||||
import com.baeldung.springamqpsimple.broadcast.BroadcastConfig;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ActiveProfiles("test")
|
||||
@SpringBootTest(webEnvironment = RANDOM_PORT)
|
||||
public class BroadcastMessageControllerIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private TestRestTemplate restTemplate;
|
||||
|
||||
@MockBean
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Test
|
||||
public void whenPostingMessage_thenMessageIsCreated() {
|
||||
final String message = "Hello World!";
|
||||
ResponseEntity<Void> responseEntity = restTemplate.postForEntity("/broadcast", message, Void.class);
|
||||
|
||||
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenPostingMessage_thenMessageIsSentToBroker() {
|
||||
final String message = "Hello World!";
|
||||
restTemplate.postForEntity("/broadcast", message, Void.class);
|
||||
|
||||
verify(rabbitTemplate).convertAndSend(BroadcastConfig.fanoutExchangeName, "", message);
|
||||
verify(rabbitTemplate).convertAndSend(BroadcastConfig.topicExchangeName, "user.not-important.info", message);
|
||||
verify(rabbitTemplate).convertAndSend(BroadcastConfig.topicExchangeName, "user.important.error", message);
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package com.baeldung.springamqpsimple;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ActiveProfiles("test")
|
||||
@SpringBootTest(webEnvironment = RANDOM_PORT)
|
||||
public class MessageControllerIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private TestRestTemplate restTemplate;
|
||||
|
||||
@MockBean
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Test
|
||||
public void whenPostingMessage_thenMessageIsCreated() {
|
||||
final String message = "Hello World!";
|
||||
ResponseEntity<Void> responseEntity = restTemplate.postForEntity("/messages", message, Void.class);
|
||||
|
||||
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenPostingMessage_thenMessageIsSentToBroker() {
|
||||
final String message = "Hello World!";
|
||||
restTemplate.postForEntity("/messages", message, Void.class);
|
||||
|
||||
verify(rabbitTemplate).convertAndSend(SpringAmqpConfig.queueName, message);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue