Polish Tests
Confirm that responses are a valid JSON map Issue gh-16177
This commit is contained in:
parent
96a9cf0d2d
commit
3d1e4b5f18
|
@ -50,6 +50,7 @@ import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.http.ResponseCookie;
|
import org.springframework.http.ResponseCookie;
|
||||||
import org.springframework.http.client.reactive.ClientHttpConnector;
|
import org.springframework.http.client.reactive.ClientHttpConnector;
|
||||||
|
@ -97,6 +98,7 @@ import org.springframework.web.server.WebSession;
|
||||||
import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
|
import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
import static org.hamcrest.Matchers.hasValue;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.BDDMockito.given;
|
import static org.mockito.BDDMockito.given;
|
||||||
import static org.mockito.Mockito.atLeastOnce;
|
import static org.mockito.Mockito.atLeastOnce;
|
||||||
|
@ -195,7 +197,10 @@ public class OidcLogoutSpecTests {
|
||||||
.body(BodyInserters.fromFormData("logout_token", "invalid"))
|
.body(BodyInserters.fromFormData("logout_token", "invalid"))
|
||||||
.exchange()
|
.exchange()
|
||||||
.expectStatus()
|
.expectStatus()
|
||||||
.isBadRequest();
|
.isBadRequest()
|
||||||
|
.expectBody(new ParameterizedTypeReference<Map<String, String>>() {
|
||||||
|
})
|
||||||
|
.value(hasValue("invalid_request"));
|
||||||
this.test.get().uri("/token/logout").cookie("SESSION", session).exchange().expectStatus().isOk();
|
this.test.get().uri("/token/logout").cookie("SESSION", session).exchange().expectStatus().isOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,9 +267,10 @@ public class OidcLogoutSpecTests {
|
||||||
.exchange()
|
.exchange()
|
||||||
.expectStatus()
|
.expectStatus()
|
||||||
.isBadRequest()
|
.isBadRequest()
|
||||||
.expectBody(String.class)
|
.expectBody(new ParameterizedTypeReference<Map<String, String>>() {
|
||||||
.value(containsString("partial_logout"))
|
})
|
||||||
.value(containsString("not all sessions were terminated"));
|
.value(hasValue("partial_logout"))
|
||||||
|
.value(hasValue(containsString("not all sessions were terminated")));
|
||||||
this.test.get().uri("/token/logout").cookie("SESSION", one).exchange().expectStatus().isOk();
|
this.test.get().uri("/token/logout").cookie("SESSION", one).exchange().expectStatus().isOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue