### Question:
ClientPlatformServiceImpl implements ClientPlatformService { @Override public List<ClientPlatform> getAllClientPlatformByCriteria(String userId, String identification, String[] ontologies) { final List<ClientPlatform> clients = getClientPlatform(userId, identification); if (ontologies != null && ontologies.length > 0) { final List<ClientPlatform> clientPlatforms = new ArrayList<>(); for (final ClientPlatform client : clients) { checkClientPlatform(clientPlatforms, ontologies, client); } return clientPlatforms; } return clients; }  @Override Token createClientAndToken(List<Ontology> ontologies, ClientPlatform clientPlatform); @Override ClientPlatform getByIdentification(String identification); @Override List<ClientPlatform> getAllClientPlatforms(); @Override List<ClientPlatform> getclientPlatformsByUser(User user); @Override List<ClientPlatform> getAllClientPlatformByCriteria(String userId, String identification,
			String[] ontologies); @Override List<AccessType> getClientPlatformOntologyAccessLevel(); @Override @Transactional ClientPlatform createClientPlatform(DeviceCreateDTO device, String userId, Boolean isUpdate); @Override @Transactional void updateDevice(DeviceCreateDTO device, String userId); @Override void createOntologyRelation(Ontology ontology, ClientPlatform clientPlatform); @Override Ontology getDeviceLogOntology(ClientPlatform client); @Override List<Token> getTokensByClientPlatformId(String clientPlatformId); @Override List<Ontology> getOntologiesByClientPlatform(String clientPlatformIdentification); @Override ClientPlatform getById(String id); @Override boolean hasUserManageAccess(String id, String userId); @Override boolean hasUserViewAccess(String id, String userId); @Override Token createClientTokenWithAccessType(Map<Ontology, AccessType> ontologies, ClientPlatform clientPlatform); @Override Ontology createDeviceLogOntology(final ClientPlatform client);  }### Answer:
@Test public void given_OneUserAdminWithClientPlatforms_When_AllClientPlatformsAreRequested_Then_AllTheClientPlatformOfTheUserAreReturned() { String userId = "userId"; String clientIdentification = "clientIdentification"; Role role = new Role(); role.setId(Role.Type.ROLE_ADMINISTRATOR.toString()); User user = new User(); user.setUserId(userId); user.setRole(role); ClientPlatform cp1 = new ClientPlatform(); cp1.setIdentification(clientIdentification); List<ClientPlatform> clients = new ArrayList<>(); clients.add(cp1); String id = "1"; Ontology ontology = new Ontology(); ontology.setId(id); ontology.setIdentification(id); String[] ontologies = new String[] { id }; ClientPlatformOntology cpo = new ClientPlatformOntology(); when(userService.getUser(userId)).thenReturn(user); when(userService.isUserAdministrator(user)).thenReturn(true); when(clientPlatformRepository.findByIdentification(clientIdentification)).thenReturn(cp1); when(clientPlatformRepository.findAll()).thenReturn(clients); when(ontologyRepository.findByIdentification(id)).thenReturn(ontology); when(clientPlatformOntologyRepository.findByOntologyAndClientPlatform(id, clientIdentification)) .thenReturn(cpo); List<ClientPlatform> allClientPlatformByCriteria = clientPlatformServiceImpl .getAllClientPlatformByCriteria(userId, clientIdentification, ontologies); assertTrue("The number of returned clients is not correct", allClientPlatformByCriteria.size() == 1); }