@Test
public void getUsersSubjectsTest() throws Exception {

	System.out.println("getUsersSubjectsTest");
	// define needed attributes
	String base = "cn=firstName,dc=dc";
	String usersQuery = "dc=cz";
	Map<String, String> mapOfAttributes = new HashMap<>();
	mapOfAttributes.put("usersQuery", usersQuery);
	mapOfAttributes.put("base", base);
	doReturn(mapOfAttributes).when(extSourceLdap).getAttributes();
	// mock connection and define received attributes
	DirContext dirContext = mock(DirContext.class);
	doReturn(dirContext).when(extSourceLdap).getContext();
	Attribute attribute = new BasicAttribute("firstName", "josef");
	Attribute attribute2 = new BasicAttribute("dc", "cz");
	Attributes attributes = new BasicAttributes();
	attributes.put(attribute);
	attributes.put(attribute2);
	NamingEnumeration<SearchResult> namingEnumeration = mock(NamingEnumeration.class);
	doReturn(namingEnumeration).when(dirContext).search(anyString(), anyString(), any());
	doReturn(true,false).when(namingEnumeration).hasMore();
	SearchResult searchResult = new SearchResult("name", namingEnumeration, attributes);
	doReturn(searchResult).when(namingEnumeration).next();
	// create expected subject to get
	List<Map<String, String>> expectedSubjects = new ArrayList<>();
	Map<String, String> subject = new HashMap<>();
	subject.put("cn", "josef");
	subject.put("dc", "cz");
	expectedSubjects.add(subject);
	// test the method
	List<Map<String, String>> actualSubjects = extSourceLdap.getUsersSubjects();
	assertEquals("subjects should be same", expectedSubjects, actualSubjects);
}