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
@@ -16,34 +16,31 @@
|
||||
|
||||
package sample.oauth2.client;
|
||||
|
||||
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;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
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-google-client-id",
|
||||
"YAHOO-CLIENT-SECRET=my-google-client-secret" })
|
||||
public class SampleReactiveOAuth2ClientApplicationTests {
|
||||
class SampleReactiveOAuth2ClientApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private WebTestClient webTestClient;
|
||||
|
||||
@Test
|
||||
public void everythingShouldRedirectToLogin() {
|
||||
void everythingShouldRedirectToLogin() {
|
||||
this.webTestClient.get().uri("/").exchange().expectStatus().isFound()
|
||||
.expectHeader().valueEquals("Location", "/login");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginShouldHaveBothOAuthClientsToChooseFrom() {
|
||||
void loginShouldHaveBothOAuthClientsToChooseFrom() {
|
||||
byte[] body = this.webTestClient.get().uri("/login").exchange().expectStatus()
|
||||
.isOk().returnResult(String.class).getResponseBodyContent();
|
||||
String bodyString = new String(body);
|
||||
|
||||
Reference in New Issue
Block a user