Skip to content
Snippets Groups Projects
Commit da10cb6f authored by Birk Øvstetun Narvhus's avatar Birk Øvstetun Narvhus
Browse files

fixed usercontroller test

parent a839c869
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
/**
* The user controller is responsible for handling requests related to users.
......@@ -69,6 +71,7 @@ public class UserController {
.lastName(user.lastName())
.dateOfBirth(user.birthDate())
.enabled(true)
.authorities(new ArrayList<>())
.build();
userService.saveUser(newUser);
userService.addAuthorityToUser(newUser.getUsername(), Authority.USER);
......
......@@ -87,7 +87,7 @@ public class User implements UserDetails {
joinColumns = @JoinColumn(name = "username"),
inverseJoinColumns = @JoinColumn(name = "authority"))
@JsonIgnoreProperties({"users"})
private List<AuthorityTable> authorities;
private List<AuthorityTable> authorities = new ArrayList<>();
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment