### Question:
OAuthClientManager implements ClientDetailsService, IOAuthClientManager { @Override public List<OAuthClient> getClientsDetails(List<String> clientList){ List<OAuthClient> clients = new ArrayList<>(); if(clientList != null && clientList.size()>0) { clients = clientRepo.findAllById(clientList); } return clients; } OAuthClientManager(OAuthClientRepository repo, BCryptPasswordEncoder bCryptPasswordEncoder, int accessTokenValidity); @Override ClientDetails loadClientByClientId(String clientId); @Override OAuthCredentials create(String name, String description, List<OAuthScope> scopes, Set<String> grantTypes, String redirectUrl); @Override OAuthClientResultPage getAllClientDetails(Pageable pageable); @Override void deleteClient(String clientId); @Override OAuthCredentials updateClientSecret(String clientId); @Override List<OAuthClient> getClientsDetails(List<String> clientList);  }### Answer:
@Test public void test_getClientsDetails() { List<String> clientList = new ArrayList<>(); clientList.add("Client1"); List<OAuthClient> clients = new ArrayList<>(); OAuthClient client1 = new OAuthClient(); client1.setClientId("Client1"); clients.add(client1); Mockito.when(clientRepo.findAllById(clientList)).thenReturn(clients); Assert.assertEquals(client1, managerToTest.getClientsDetails(clientList).get(0)); }
@Test public void test_getClientsDetails_clientNotFound() { List<String> clientList = new ArrayList<>(); clientList.add("Client1"); Mockito.when(clientRepo.findAllById(clientList)).thenReturn(new ArrayList<>()); Assert.assertEquals(0, managerToTest.getClientsDetails(clientList).size()); }
@Test public void test_getClientsDetails_fewClientsNotFound() { List<String> clientList = new ArrayList<>(); clientList.add("Client1"); clientList.add("Client2"); List<OAuthClient> clients = new ArrayList<>(); OAuthClient client1 = new OAuthClient(); client1.setClientId("Client1"); clients.add(client1); Mockito.when(clientRepo.findAllById(clientList)).thenReturn(clients); Assert.assertEquals(1, managerToTest.getClientsDetails(clientList).size()); Assert.assertEquals(client1, managerToTest.getClientsDetails(clientList).get(0)); }
@Test public void test_getClientsDetails_emptyList() { Assert.assertEquals(0, managerToTest.getClientsDetails(new ArrayList<>()).size()); }