### Question:
UsersServiceImpl extends BaseApiService<Directory> implements UsersService { @Override public Iterable<User> listUsers(String schemaName) throws IOException { return new UsersIterable(schemaName); } private  UsersServiceImpl(Builder builder); static UsersServiceImpl fromConfiguration(CredentialFactory credentialFactory); @Override ListenableFuture<User> getUserMapping(String userId); @Override ListenableFuture<User> updateUserMapping(
      String userId, String schemaName, String attributeName, Optional<String> value); @Override Iterable<User> listUsers(String schemaName);  }### Answer:
@Test public void testListUsers() throws Exception { Users.List list1 = mock(Users.List.class); when(list1.setCustomer("customer1")).thenReturn(list1); when(list1.setCustomFieldMask("schema")).thenReturn(list1); when(list1.setProjection("custom")).thenReturn(list1); when(list1.setPageToken(null)).thenReturn(list1); User user1 = new User().setPrimaryEmail("user1@mydomain.com"); when(list1.execute()) .thenReturn( new com.google.api.services.admin.directory.model.Users() .setNextPageToken("nextPage") .setUsers(Collections.singletonList(user1))); Users.List list2 = mock(Users.List.class); when(list2.setCustomer("customer1")).thenReturn(list2); when(list2.setCustomFieldMask("schema")).thenReturn(list2); when(list2.setProjection("custom")).thenReturn(list2); when(list2.setPageToken("nextPage")).thenReturn(list2); User user2 = new User().setPrimaryEmail("user2@mydomain.com"); when(list2.execute()) .thenReturn( new com.google.api.services.admin.directory.model.Users() .setUsers(Collections.singletonList(user2))); when(users.list()).thenReturn(list1, list2); Iterable<User> actual = usersService.listUsers("schema"); assertTrue(Iterables.elementsEqual(ImmutableList.of(user1, user2), actual)); }