cleanup work for tests
This commit is contained in:
parent
4a489e4afc
commit
5fd8e4293e
Binary file not shown.
|
@ -13,7 +13,7 @@ import com.baeldung.Spring5Application;
|
|||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Spring5Application.class)
|
||||
public class BeanRegistrationTest {
|
||||
public class BeanRegistrationIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private GenericWebApplicationContext context;
|
|
@ -13,7 +13,7 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
|||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = SpringSecurity5Application.class)
|
||||
public class SecurityTest {
|
||||
public class SecurityIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
ApplicationContext context;
|
||||
|
@ -22,27 +22,17 @@ public class SecurityTest {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
this.rest = WebTestClient
|
||||
.bindToApplicationContext(this.context)
|
||||
.configureClient()
|
||||
.build();
|
||||
this.rest = WebTestClient.bindToApplicationContext(this.context).configureClient().build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenNoCredentials_thenRedirectToLogin() {
|
||||
this.rest.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
.expectStatus().is3xxRedirection();
|
||||
this.rest.get().uri("/").exchange().expectStatus().is3xxRedirection();
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser
|
||||
public void whenHasCredentials_thenSeesGreeting() {
|
||||
this.rest.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
.expectStatus().isOk()
|
||||
.expectBody(String.class).isEqualTo("Hello, user");
|
||||
this.rest.get().uri("/").exchange().expectStatus().isOk().expectBody(String.class).isEqualTo("Hello, user");
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class SessionAttrsApplicationTests {
|
||||
public class SessionAttrsApplicationIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
|
@ -25,7 +25,7 @@ import org.springframework.web.context.WebApplicationContext;
|
|||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@Import(TestConfig.class)
|
||||
public class TodoControllerWithScopedProxyTest {
|
||||
public class TodoControllerWithScopedProxyIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
|
@ -24,7 +24,7 @@ import org.springframework.web.servlet.FlashMap;
|
|||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
public class TodoControllerWithSessionAttributesTest {
|
||||
public class TodoControllerWithSessionAttributesIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
|
@ -16,7 +16,7 @@ import reactor.core.publisher.Mono;
|
|||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Spring5Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class WebTestClientTest {
|
||||
public class WebTestClientIntegrationTest {
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
|
@ -23,7 +23,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Application.class)
|
||||
public class UserRepositoryTest {
|
||||
public class UserRepositoryIntegrationTest {
|
||||
|
||||
private final String USER_NAME_ADAM = "Adam";
|
||||
private final Integer ACTIVE_STATUS = 1;
|
Loading…
Reference in New Issue