@@ -0,0 +1,1573 @@
+package com.pollistics.services;%0A%0Aimport com.pollistics.PollisticsApplication;%0Aimport com.pollistics.models.SecUserDetails;%0Aimport com.pollistics.models.User;%0Aimport com.pollistics.repositories.UserRepository;%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.security.core.userdetails.UserDetails;%0Aimport org.springframework.security.core.userdetails.UsernameNotFoundException;%0Aimport org.springframework.test.context.junit4.SpringRunner;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0A@RunWith(SpringRunner.class)%0A@SpringBootTest(classes = PollisticsApplication.class)%0Apublic class UserServiceTests %7B%0A%09@Autowired%0A%09private UserRepository userRepo;%0A%0A%09@Autowired%0A%09private UserService userService;%0A%0A%09@Test%0A%09public void createUserTest() %7B%0A%09%09User u = new User(%22gebruikersnaam%22, %22Azerty123%22);%0A%09%09userService.createUser(u);%0A%09%7D%0A%0A%09@Test%0A%09public void userExistsTest() %7B%0A%09%09User u = userRepo.findAll().get(0);%0A%09%09boolean result = userService.userExists(u.getUsername());%0A%09%09assert(result);%0A%09%7D%0A%0A%09@Test%0A%09public void loadUserByUsernameTest() %7B%0A%09%09User u = userRepo.findAll().get(0);%0A%09%09UserDetails det = userService.loadUserByUsername(u.getUsername());%0A%09%09SecUserDetails secUser = new SecUserDetails(u);%0A%09%09assertThat(det.equals(secUser));%0A%09%7D%0A%0A%09@Test(expected = UsernameNotFoundException.class)%0A%09public void loadUserByUsernameTestFailing() %7B%0A%09%09userService.loadUserByUsername(%22stupid fake username that doesn't exist%22);%0A%09%7D%0A%7D%0A

add test for userService