ExtSourceTCS extends ExtSource implements ExtSourceApi { @Override public List<Map<String, String>> getUsersSubjects() { String url = getAttributes().get(UsersManager.USERS_QUERY); return getUsersOrGroupSubjects(url); }  static PerunBlImpl setPerunBlImpl(PerunBlImpl perun); @Override List<Map<String,String>> findSubjectsLogins(String searchString); @Override List<Map<String, String>> findSubjects(String searchString); @Override List<Map<String, String>> findSubjects(String searchString, int maxResults); @Override List<Map<String, String>> findSubjectsLogins(String searchString, int maxResults); @Override List<Map<String, String>> getSubjectGroups(Map<String, String> attributes); @Override List<Map<String, String>> getUsersSubjects(); @Override Map<String, String> getSubjectByLogin(String login); @Override void close(); @Override List<Map<String, String>> getGroupSubjects(Map<String, String> attributes);  }
@Test public void getUsersSubjects() { X509CertificateHolder certificateHolder = mock(X509CertificateHolder.class, RETURNS_DEEP_STUBS); when(certificateHolder.getSubject().toString()).thenReturn("certificate"); Map<String, Pair<X509CertificateHolder, String>> validCertificatesForLogin = new HashMap<>(); validCertificatesForLogin.put("123456", new Pair<>(certificateHolder, "value")); doReturn(validCertificatesForLogin).when(extSourceTCS).prepareStructureOfValidCertificates("url"); Map<String, String> mapOfAttributes = new HashMap<>(); mapOfAttributes.put("usersQuery", "url"); mapOfAttributes.put("googleMapping", "userID={userID},\ndomainName={domainName},\ngroupName={groupName}"); doReturn(mapOfAttributes).when(extSourceTCS).getAttributes(); List<Map<String, String>> expectedSubjects = new ArrayList<>(); Map<String, String> subject = new HashMap<>(); subject.put("login", "123456"); subject.put("additionalues_1", "https: subject.put("urn:perun:user:attribute-def:def:userCertificates", "certificate:value,"); expectedSubjects.add(subject); List<Map<String, String>> actualSubjects = extSourceTCS.getUsersSubjects(); assertEquals("subjects should be same", expectedSubjects, actualSubjects); }