@@ -0,0 +1,2956 @@
+package at.ac.tuwien.inso.dao_tests;%0A%0Aimport at.ac.tuwien.inso.entity.*;%0Aimport at.ac.tuwien.inso.repository.UisUserRepository;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.context.SpringBootTest;%0Aimport org.springframework.data.domain.Page;%0Aimport org.springframework.test.context.ActiveProfiles;%0Aimport org.springframework.test.context.junit4.SpringRunner;%0Aimport org.springframework.transaction.annotation.Transactional;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0A@RunWith(SpringRunner.class)%0A@SpringBootTest%0A@ActiveProfiles(%22test%22)%0A@Transactional%0Apublic class UisUserRepositoryTests %7B%0A%0A    @Autowired%0A    private UisUserRepository uisUserRepository;%0A%0A    private Map%3CString, UisUser%3E uisUsers = new HashMap%3CString, UisUser%3E() %7B%0A        %7B%0A            put(%22lecturer1%22, new Lecturer(%22l12345%22, %22lecturer1%22, %22l12345@uis.at%22));%0A            put(%22lecturer2%22, new Lecturer(%22l54321%22, %22lecturer2%22, %22l54321@uis.at%22));%0A            put(%22student%22, new Student(%22s12345%22, %22student%22, %22s12345@uis.at%22));%0A        %7D%0A    %7D;%0A%0A    @Before%0A    public void setUp() %7B%0A        uisUserRepository.save(uisUsers.values());%0A    %7D%0A%0A    @Test%0A    public void testFindAllMatchingSomeExistingUsersUsingIdentificationNumber() %7B%0A        Page%3CUisUser%3E foundUsers = uisUserRepository.findAllMatching(%2212345%22, null);%0A        assertTrue(foundUsers.getContent().contains(uisUsers.get(%22lecturer1%22)));%0A        assertTrue(foundUsers.getContent().contains(uisUsers.get(%22student%22)));%0A    %7D%0A%0A    @Test%0A    public void testFindAllMatchingSomeExistingUsersUsingNameIgnoreCase() %7B%0A        Page%3CUisUser%3E foundUsers = uisUserRepository.findAllMatching(%22lecTURer%22, null);%0A        assertTrue(foundUsers.getContent().contains(uisUsers.get(%22lecturer1%22)));%0A        assertTrue(foundUsers.getContent().contains(uisUsers.get(%22lecturer2%22)));%0A    %7D%0A%0A    @Test%0A    public void testFindAllMatchingSomeExistingUsersUsingEmail() %7B%0A        Page%3CUisUser%3E foundUsers = uisUserRepository.findAllMatching(%22s12345@uis.at%22, null);%0A        assertTrue(foundUsers.getContent().contains(uisUsers.get(%22student%22)));%0A    %7D%0A%0A    @Test%0A    public void testFindAllMatchingNoContent() %7B%0A        Page%3CUisUser%3E foundUsers = uisUserRepository.findAllMatching(%22some_non_existing_content%22, null);%0A        assertFalse(foundUsers.hasContent());%0A    %7D%0A%0A    @Test%0A    public void testExistsForExistingIdentificationNumber() throws Exception %7B%0A        Lecturer lecturer1 = (Lecturer) uisUsers.get(%22lecturer1%22);%0A        assertTrue(uisUserRepository.existsByIdentificationNumber(lecturer1.getIdentificationNumber()));%0A    %7D%0A%0A    @Test%0A    public void testExistsForNonExistingIdentificationNumber() throws Exception %7B%0A        assertFalse(uisUserRepository.existsByIdentificationNumber(%22some_non_existing_id%22));%0A    %7D%0A%7D%0A%0A

test the UisUserRepository