-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69996a5
commit 075e4f5
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
import com.fasterxml.jackson.core.type.TypeReference; | ||
import java.util.*; | ||
import java.util.function.Consumer; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.junit.jupiter.api.*; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.mock.mockito.SpyBean; | ||
|
@@ -31,6 +32,7 @@ | |
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.web.reactive.server.WebTestClient; | ||
|
||
@Slf4j | ||
@ActiveProfiles("test-login-enabled") | ||
@MockIntegrationTest | ||
@ContextConfiguration(classes = {TestApplication.class}) | ||
|
@@ -429,6 +431,25 @@ void givenUserCreated_whenSearch_thenReturnOk() { | |
assertThat(bodyStr, hasJsonPath("$.data.data", hasSize(greaterThanOrEqualTo(1)))); | ||
assertThat(bodyStr, hasJsonPath("$.data.data[0].email", equalTo("[email protected]"))); | ||
}); | ||
|
||
// search by role and state | ||
testClientHelper.requestAndVerify( | ||
HttpMethod.GET, | ||
(uriBuilder -> | ||
uriBuilder | ||
.path("/users") | ||
.queryParam("role", "USER") | ||
.queryParam("state", "ENABLED") | ||
.build()), | ||
headers, | ||
null, | ||
HttpStatus.OK.value(), | ||
bodyStr -> { | ||
log.info("bodyStr:{}", bodyStr); | ||
Assertions.assertNotNull(bodyStr); | ||
assertThat(bodyStr, hasJsonPath("$.data.data", notNullValue())); | ||
assertThat(bodyStr, hasJsonPath("$.data.data", hasSize(greaterThanOrEqualTo(3)))); | ||
}); | ||
} | ||
|
||
@Test | ||
|