|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2020 the original author or authors. |
| 2 | + * Copyright 2002-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
51 | 51 |
|
52 | 52 | import static org.assertj.core.api.Assertions.assertThat;
|
53 | 53 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
| 54 | +import static org.assertj.core.api.Assertions.assertThatNoException; |
54 | 55 | import static org.mockito.ArgumentMatchers.any;
|
55 | 56 | import static org.mockito.BDDMockito.given;
|
56 | 57 | import static org.mockito.Mockito.mock;
|
@@ -144,6 +145,24 @@ public void loadUserWhenUserInfoSuccessResponseThenReturnUser() {
|
144 | 145 | assertThat(userAuthority.getAttributes()).isEqualTo(user.getAttributes());
|
145 | 146 | }
|
146 | 147 |
|
| 148 | + // gh-9336 |
| 149 | + @Test |
| 150 | + public void loadUserWhenUserInfo201CreatedResponseThenReturnUser() { |
| 151 | + // @formatter:off |
| 152 | + String userInfoResponse = "{\n" |
| 153 | + + " \"id\": \"user1\",\n" |
| 154 | + + " \"first-name\": \"first\",\n" |
| 155 | + + " \"last-name\": \"last\",\n" |
| 156 | + + " \"middle-name\": \"middle\",\n" |
| 157 | + + " \"address\": \"address\",\n" |
| 158 | + + " \"email\": \"[email protected]\"\n" |
| 159 | + + "}\n"; |
| 160 | + // @formatter:on |
| 161 | + this.server.enqueue(new MockResponse().setResponseCode(201) |
| 162 | + .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setBody(userInfoResponse)); |
| 163 | + assertThatNoException().isThrownBy(() -> this.userService.loadUser(oauth2UserRequest()).block()); |
| 164 | + } |
| 165 | + |
147 | 166 | // gh-5500
|
148 | 167 | @Test
|
149 | 168 | public void loadUserWhenAuthenticationMethodHeaderSuccessResponseThenHttpMethodGet() throws Exception {
|
|
0 commit comments