ExtSourceISMU extends ExtSource implements ExtSourceSimpleApi { @Override public List<Map<String, String>> getUsersSubjects() { String queryForUsers = getAttributes().get(UsersManager.USERS_QUERY); return querySource(queryForUsers, null, 0); }  static PerunBlImpl setPerunBlImpl(PerunBlImpl perun); @Override List<Map<String,String>> findSubjectsLogins(String searchString); @Override List<Map<String, String>> findSubjectsLogins(String searchString, int maxResults); @Override Map<String, String> getSubjectByLogin(String login); @Override List<Map<String, String>> getGroupSubjects(Map<String, String> attributes); @Override List<Map<String, String>> getUsersSubjects(); @Override void close(); @Override List<Map<String, String>> getSubjectGroups(Map<String, String> attributes);  }
@Test public void getUsersSubjectsTest() throws Exception { System.out.println("getUsersSubjectsTest"); String usersQuery = "https: Map<String, String> mapOfAttributes = new HashMap<>(); mapOfAttributes.put("usersQuery", usersQuery); doReturn(mapOfAttributes).when(extSourceISMU).getAttributes(); List<Map<String, String>> expectedSubjects = new ArrayList<>(); Map<String, String> subject = new HashMap<>(); subject.put("login", "123456"); subject.put("titleBefore", null); subject.put("firstName", "Metodej"); subject.put("lastName", "Klang"); subject.put("additionalues_1", "https: subject.put("titleAfter", null); expectedSubjects.add(subject); HttpURLConnection http = mock(HttpURLConnection.class); doReturn(http).when(extSourceISMU).getHttpConnection(usersQuery, null); String input = "123456;;\"Metodej Klang\";Klang;Metodej;"; InputStream is = new ByteArrayInputStream(input.getBytes()); doReturn(is).when(http).getInputStream(); List<Map<String, String>> actualSubjects = extSourceISMU.getUsersSubjects(); assertEquals("subjects should be same", expectedSubjects, actualSubjects); }