// Path: src/main/java/com/pollistics/services/UserService.java
// @Service
// public class UserService implements UserDetailsService {
// 
// 	@Autowired
// 	private UserRepository userRepository;
// 
// 	public boolean userExists(String username) {
// 		return userRepository.findByUsername(username) != null;
// 	}
// 
// 	public void createUser(User user) {
// 		BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
// 		String hashedPassword = passwordEncoder.encode(user.getPassword());
// 		user.setPassword(hashedPassword);
// 		userRepository.insert(user);
// 	}
// 
// 	@Override
// 	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
// 		User user = userRepository.findByUsername(username);
// 		if(user == null){
// 			throw new UsernameNotFoundException(username);
// 		} else{
// 			return user;
// 		}
// 	}
// }


import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated;
import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.unauthenticated;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrlPattern;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import com.pollistics.services.UserService;
package com.pollistics.controllers;



//import com.pollistics.services.PollService;

@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
@ContextConfiguration
public class AccountControllerTests {
	@MockBean
// Path: src/main/java/com/pollistics/services/UserService.java
// @Service
// public class UserService implements UserDetailsService {
// 
// 	@Autowired
// 	private UserRepository userRepository;
// 
// 	public boolean userExists(String username) {
// 		return userRepository.findByUsername(username) != null;
// 	}
// 
// 	public void createUser(User user) {
// 		BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
// 		String hashedPassword = passwordEncoder.encode(user.getPassword());
// 		user.setPassword(hashedPassword);
// 		userRepository.insert(user);
// 	}
// 
// 	@Override
// 	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
// 		User user = userRepository.findByUsername(username);
// 		if(user == null){
// 			throw new UsernameNotFoundException(username);
// 		} else{
// 			return user;
// 		}
// 	}
// }


// Path: src/test/java/com/pollistics/controllers/AccountControllerTests.java
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated;
import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.unauthenticated;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrlPattern;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import com.pollistics.services.UserService;

package com.pollistics.controllers;



//import com.pollistics.services.PollService;

@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
@ContextConfiguration
public class AccountControllerTests {
	@MockBean
	private UserService userService;