Use AssertJ in spring-boot-samples
See gh-5083
This commit is contained in:
@@ -24,7 +24,6 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.WebIntegrationTest;
|
||||
import samples.websocket.tomcat.SampleTomcatWebSocketApplication;
|
||||
import samples.websocket.tomcat.client.GreetingService;
|
||||
import samples.websocket.tomcat.client.SimpleClientWebSocketHandler;
|
||||
@@ -38,6 +37,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.boot.test.WebIntegrationTest;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -47,7 +47,7 @@ import org.springframework.util.SocketUtils;
|
||||
import org.springframework.web.socket.client.WebSocketConnectionManager;
|
||||
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration({ SampleTomcatWebSocketApplication.class,
|
||||
@@ -72,8 +72,9 @@ public class CustomContainerWebSocketsApplicationTests {
|
||||
AtomicReference<String> messagePayloadReference = context
|
||||
.getBean(ClientConfiguration.class).messagePayload;
|
||||
context.close();
|
||||
assertEquals(0, count);
|
||||
assertEquals("Did you say \"Hello world!\"?", messagePayloadReference.get());
|
||||
assertThat(count).isEqualTo(0);
|
||||
assertThat(messagePayloadReference.get())
|
||||
.isEqualTo("Did you say \"Hello world!\"?");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -87,8 +88,8 @@ public class CustomContainerWebSocketsApplicationTests {
|
||||
AtomicReference<String> messagePayloadReference = context
|
||||
.getBean(ClientConfiguration.class).messagePayload;
|
||||
context.close();
|
||||
assertEquals(0, count);
|
||||
assertEquals("Reversed: !dlrow olleH", messagePayloadReference.get());
|
||||
assertThat(count).isEqualTo(0);
|
||||
assertThat(messagePayloadReference.get()).isEqualTo("Reversed: !dlrow olleH");
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
Reference in New Issue
Block a user