From da8560b323f3d0f3146def1327c3f9ea3945e93c Mon Sep 17 00:00:00 2001 From: Slavik Markovich Date: Tue, 30 Apr 2024 14:04:01 -0700 Subject: [PATCH] Add total users count to the search results --- .../descope/model/user/response/AllUsersResponseDetails.java | 1 + .../java/com/descope/sdk/mgmt/impl/UserServiceImplTest.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/descope/model/user/response/AllUsersResponseDetails.java b/src/main/java/com/descope/model/user/response/AllUsersResponseDetails.java index 04656e86..f2c3684b 100644 --- a/src/main/java/com/descope/model/user/response/AllUsersResponseDetails.java +++ b/src/main/java/com/descope/model/user/response/AllUsersResponseDetails.java @@ -10,4 +10,5 @@ @AllArgsConstructor public class AllUsersResponseDetails { private List users; + private int total; } diff --git a/src/test/java/com/descope/sdk/mgmt/impl/UserServiceImplTest.java b/src/test/java/com/descope/sdk/mgmt/impl/UserServiceImplTest.java index 9f683065..8eaf7828 100644 --- a/src/test/java/com/descope/sdk/mgmt/impl/UserServiceImplTest.java +++ b/src/test/java/com/descope/sdk/mgmt/impl/UserServiceImplTest.java @@ -753,7 +753,7 @@ void testGenerateEmbeddedLinkForSuccess() { @Test void testSearchAllForSuccess() { UserResponse userResponse = mock(UserResponse.class); - AllUsersResponseDetails allUsersResponse = new AllUsersResponseDetails(Arrays.asList(userResponse)); + AllUsersResponseDetails allUsersResponse = new AllUsersResponseDetails(Arrays.asList(userResponse), 0); UserSearchRequest userSearchRequest = UserSearchRequest.builder().limit(6).page(1).build(); ApiProxy apiProxy = mock(ApiProxy.class); doReturn(allUsersResponse).when(apiProxy).post(any(), any(), any()); @@ -853,6 +853,7 @@ void testFunctionalFullCycle() { } } assertTrue(found); + assertTrue(searchResponse.getTotal() > 0); // Delete userService.delete(newLoginId); } @@ -886,6 +887,7 @@ void testFunctionalTestUsers() { } } assertTrue(found); + assertTrue(searchResponse.getTotal() > 0); searchResponse = userService .searchAll(UserSearchRequest.builder().testUsersOnly(true).emails(Arrays.asList(user.getEmail())).build()); found = false; @@ -896,6 +898,7 @@ void testFunctionalTestUsers() { } } assertTrue(found); + assertTrue(searchResponse.getTotal() > 0); // Delete userService.delete(loginId); }