Validate our own tests work with JUnit5 and the vintage engine
Closes gh-14737 Co-authored-by: Stephane Nicoll <snicoll@pivotal.io>
This commit is contained in:
committed by
Stephane Nicoll
parent
d9f339a1b6
commit
1db1c8b03c
@@ -18,8 +18,7 @@ package sample.oauth2.client;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -27,16 +26,14 @@ import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
properties = { "APP-CLIENT-ID=my-client-id", "APP-CLIENT-SECRET=my-client-secret",
|
||||
"YAHOO-CLIENT-ID=my-yahoo-client-id",
|
||||
"YAHOO-CLIENT-SECRET=my-yahoo-client-secret" })
|
||||
public class SampleOAuth2ClientApplicationTests {
|
||||
class SampleOAuth2ClientApplicationTests {
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
@@ -45,7 +42,7 @@ public class SampleOAuth2ClientApplicationTests {
|
||||
private TestRestTemplate restTemplate;
|
||||
|
||||
@Test
|
||||
public void everythingShouldRedirectToLogin() {
|
||||
void everythingShouldRedirectToLogin() {
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
assertThat(entity.getHeaders().getLocation())
|
||||
@@ -53,7 +50,7 @@ public class SampleOAuth2ClientApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginShouldHaveAllOAuth2ClientsToChooseFrom() {
|
||||
void loginShouldHaveAllOAuth2ClientsToChooseFrom() {
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/login",
|
||||
String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
|
||||
Reference in New Issue
Block a user