commit 503463be4040afd3fe955c67505f6b94968d5cc3
Author: Jakub Danek <jakub.danek@yoso.fi>
Date:   Mon Oct 14 14:46:33 2019 +0200

    re #29 split User into abstract class and RegisteredUser class
    
    General user-info turned into interface in order to support multiple
    user info sources (authentication methods)

diff --git a/server/src/main/java/org/danekja/ymanager/business/auth/service/RegisteredUserService.java b/server/src/main/java/org/danekja/ymanager/business/auth/service/RegisteredUserService.java
new file mode 100644
index 0000000..cf730a3
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/business/auth/service/RegisteredUserService.java
@@ -0,0 +1,31 @@
+package org.danekja.ymanager.business.auth.service;
+
+import org.danekja.ymanager.repository.UserRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.stereotype.Service;
+
+@Service
+public class RegisteredUserService implements UserDetailsService {
+
+    private final UserRepository userRepository;
+
+    @Autowired
+    public RegisteredUserService(UserRepository userRepository) {
+        this.userRepository = userRepository;
+    }
+
+    @Override
+    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+        UserDetails details = userRepository.getUser(username);
+
+        //interface contract enforces this behavior
+        if (details == null) {
+            throw new UsernameNotFoundException("Username " + username + " not found!");
+        }
+
+        return details;
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/business/impl/DefaultUserManager.java b/server/src/main/java/org/danekja/ymanager/business/impl/DefaultUserManager.java
index fbd539c..a6eb5e7 100644
--- a/server/src/main/java/org/danekja/ymanager/business/impl/DefaultUserManager.java
+++ b/server/src/main/java/org/danekja/ymanager/business/impl/DefaultUserManager.java
@@ -13,9 +13,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataAccessException;
-import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDate;
@@ -27,7 +25,7 @@ import java.util.List;
  * Also implements {@link UserDetailsService} to allow integration with Spring Security framework.
  */
 @Service
-public class DefaultUserManager implements UserManager, UserDetailsService {
+public class DefaultUserManager implements UserManager {
 
     private static final Logger LOG = LoggerFactory.getLogger(DefaultUserManager.class);
 
@@ -67,15 +65,4 @@ public class DefaultUserManager implements UserManager, UserDetailsService {
         }
     }
 
-    @Override
-    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
-        UserDetails details = userRepository.getUser(username);
-
-        //interface contract enforces this behavior
-        if (details == null) {
-            throw new UsernameNotFoundException("Username " + username + " not found!");
-        }
-
-        return details;
-    }
 }
diff --git a/server/src/main/java/org/danekja/ymanager/domain/RegisteredUser.java b/server/src/main/java/org/danekja/ymanager/domain/RegisteredUser.java
new file mode 100644
index 0000000..4277194
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/domain/RegisteredUser.java
@@ -0,0 +1,218 @@
+package org.danekja.ymanager.domain;
+
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import java.time.LocalDateTime;
+import java.util.Collection;
+import java.util.Collections;
+
+public class RegisteredUser extends User implements UserDetails {
+
+    /**
+     * The maximal length of a name.
+     */
+    private static final int NAME_LENGTH = 45;
+
+    /**
+     * The maximal length of an email address.
+     */
+    private static final int EMAIL_ADDRESS_LENGTH = 100;
+
+    /**
+     * The user's first name.
+     */
+    private String firstName;
+
+    /**
+     * The user's last name.
+     */
+    private String lastName;
+
+    /**
+     * The user's email address.
+     */
+    private String email;
+
+    /**
+     * The URL of a user's photo.
+     */
+    private String photo;
+
+    /**
+     * The date and time of a user's creation.
+     */
+    private LocalDateTime creationDate;
+
+    public RegisteredUser() {
+    }
+
+    public RegisteredUser(Long id, String firstName, String lastName, Float vacationCount, Integer totalSickDayCount, Integer takenSickDayCount, LocalDateTime notification, String token, String email, String photo, LocalDateTime creationDate, UserRole role, Status status) {
+        super(id, vacationCount, totalSickDayCount, takenSickDayCount, notification, token, role, status);
+        this.id = id;
+        this.firstName = firstName;
+        this.lastName = lastName;
+        this.email = email;
+        this.photo = photo;
+        this.creationDate = creationDate;
+        this.role = role;
+        this.status = status;
+    }
+
+    /*
+########################### UserDetails API #################################
+ */
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        //TODO do not create collection on each call
+        return Collections.singleton(new SimpleGrantedAuthority(role.name()));
+    }
+
+    @Override
+    public String getPassword() {
+        return null;
+    }
+
+    @Override
+    public String getUsername() {
+        return getEmail();
+    }
+
+    @Override
+    public boolean isAccountNonExpired() {
+        //unsupported functionality
+        return true;
+    }
+
+    @Override
+    public boolean isAccountNonLocked() {
+        //unsupported functionality
+        return true;
+    }
+
+    @Override
+    public boolean isCredentialsNonExpired() {
+        //unsupported functionality
+        return true;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return status == Status.ACCEPTED;
+    }
+
+    /*
+    ################# UserDetails API (END) #########################
+     */
+
+    @Override
+    public String getFirstName() {
+        return firstName;
+    }
+
+    @Override
+    public String getLastName() {
+        return lastName;
+    }
+
+    @Override
+    public String getEmail() {
+        return email;
+    }
+
+    @Override
+    public String getPhoto() {
+        return photo;
+    }
+
+    @Override
+    public LocalDateTime getCreationDate() {
+        return creationDate;
+    }
+
+    /**
+     * Replaces the user's first name with the new specified value.
+     * If the given name is longer than the maximal allowed number of characters the method throws an exception.
+     *
+     * @param firstName the new first name
+     * @throws IllegalArgumentException when the given name is longer than the maximal allowed number of characters
+     */
+    public void setFirstName(final String firstName) throws IllegalArgumentException {
+        User.log.debug("Setting a new first name: {}", firstName);
+
+        if (firstName == null) {
+            User.log.warn("The given first name must not be null");
+            throw new IllegalArgumentException("first.name.null.error");
+        } else if (firstName.length() > NAME_LENGTH) {
+            User.log.warn("The length of the given first name exceeded a limit");
+            throw new IllegalArgumentException("name.length.error");
+        }
+
+        this.firstName = firstName;
+    }
+
+    /**
+     * Replaces the user's last name with the given one.
+     * If the given name is longer than the maximal allowed number of characters the method throws an exception.
+     *
+     * @param lastName the new last name
+     * @throws IllegalArgumentException when the given name is longer than the maximal allowed number of characters
+     */
+    public void setLastName(final String lastName) throws IllegalArgumentException {
+        User.log.debug("Setting a new last name: {}", lastName);
+
+        if (lastName == null) {
+            User.log.warn("The given last name must not be null");
+            throw new IllegalArgumentException("last.name.null.error");
+        } else if (lastName.length() > NAME_LENGTH) {
+            User.log.warn("The length of the given last name exceeded a limit");
+            throw new IllegalArgumentException("name.length.error");
+        }
+
+        this.lastName = lastName;
+    }
+
+    /**
+     * Replaces the user's email address with the new given value.
+     * If the given email is longer than the maximal allowed number of characters the method throws an exception.
+     *
+     * @param email the new email address
+     * @throws IllegalArgumentException when the given email is longer than the maximal allowed number of characters
+     */
+    public void setEmail(final String email) throws IllegalArgumentException {
+        User.log.debug("Setting a new email address: {}", email);
+
+        if (email == null) {
+            User.log.warn("The given email must not be null");
+            throw new IllegalArgumentException("email.null.error");
+        } else if (email.length() > EMAIL_ADDRESS_LENGTH) {
+            User.log.warn("The length of the email address exceeded a limit");
+            throw new IllegalArgumentException("email.length.error");
+        }
+
+        this.email = email;
+    }
+
+    /**
+     * Replaces the URL of a user's photo with the given link.
+     *
+     * @param photo the new URL of the user's photo
+     */
+    public void setPhoto(final String photo) {
+        User.log.debug("Setting a new url of a photo: {}", photo);
+
+        this.photo = photo == null ? User.DEFAULT_PHOTO : photo;
+    }
+
+    /**
+     * Replaces the user's creation date with the given date and time.
+     *
+     * @param creationDate the new creation date
+     */
+    public void setCreationDate(final LocalDateTime creationDate) {
+        User.log.debug("Setting a new user's creation date: {}", creationDate);
+
+        this.creationDate = creationDate;
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/domain/User.java b/server/src/main/java/org/danekja/ymanager/domain/User.java
index 12f8f42..d858f6b 100644
--- a/server/src/main/java/org/danekja/ymanager/domain/User.java
+++ b/server/src/main/java/org/danekja/ymanager/domain/User.java
@@ -2,14 +2,9 @@ package org.danekja.ymanager.domain;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
 
 import java.time.LocalDateTime;
 import java.time.LocalTime;
-import java.util.Collection;
-import java.util.Collections;
 
 import static java.time.temporal.ChronoUnit.MINUTES;
 
@@ -17,158 +12,72 @@ import static java.time.temporal.ChronoUnit.MINUTES;
  * The domain class {@code User} represents a single record in the 'end_user' table of a database.
  * User holds all informations about a user which is logged to the application.
  */
-public class User implements UserDetails {
-    /**
-     * The maximal length of a name.
-     */
-    private static final int NAME_LENGTH = 45;
-
-    /**
-     * The maximal length of an email address.
-     */
-    private static final int EMAIL_ADDRESS_LENGTH = 100;
+public abstract class User {
 
     /**
      * The url of a generic photo.
      */
-    private static final String DEFAULT_PHOTO = "https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg";
+    protected static final String DEFAULT_PHOTO = "https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg";
 
     /**
      * The logger.
      */
-    private static final Logger log = LoggerFactory.getLogger(User.class);
+    protected static final Logger log = LoggerFactory.getLogger(User.class);
 
     /**
      * The user's ID.
      */
-    private Long id;
-
-    /**
-     * The user's first name.
-     */
-    private String firstName;
-
-    /**
-     * The user's last name.
-     */
-    private String lastName;
+    protected Long id;
 
     /**
      * The number of user's remaining hours of an overtime.
      */
-    private Float vacationCount;
+    protected Float vacationCount;
 
     /**
      * The number of user's sick days available during a year.
      */
-    private Integer totalSickDayCount;
+    protected Integer totalSickDayCount;
 
     /**
      * The number of user's taken sick days.
      */
-    private Integer takenSickDayCount;
+    protected Integer takenSickDayCount;
 
     /**
      * The date and time of sending an email warning about an incoming reset of remaining overtimes and sick days.
      */
-    private LocalDateTime notification;
+    protected LocalDateTime notification;
 
     /**
      * The token for the Google oAuth.
      */
-    private String token;
-
-    /**
-     * The user's email address.
-     */
-    private String email;
-
-    /**
-     * The URL of a user's photo.
-     */
-    private String photo;
-
-    /**
-     * The date and time of a user's creation.
-     */
-    private LocalDateTime creationDate;
+    protected String token;
 
     /**
      * The user's role.
      */
-    private UserRole role;
+    protected UserRole role;
 
     /**
      * The user's authorization status.
      */
-    private Status status;
+    protected Status status;
 
     public User() {
     }
 
-    public User(Long id, String firstName, String lastName, Float vacationCount, Integer totalSickDayCount, Integer takenSickDayCount, LocalDateTime notification, String token, String email, String photo, LocalDateTime creationDate, UserRole role, Status status) {
+    public User(Long id, Float vacationCount, Integer totalSickDayCount, Integer takenSickDayCount, LocalDateTime notification, String token, UserRole role, Status status) {
         this.id = id;
-        this.firstName = firstName;
-        this.lastName = lastName;
         this.vacationCount = vacationCount;
         this.totalSickDayCount = totalSickDayCount;
         this.takenSickDayCount = takenSickDayCount;
         this.notification = notification;
         this.token = token;
-        this.email = email;
-        this.photo = photo;
-        this.creationDate = creationDate;
         this.role = role;
         this.status = status;
     }
 
-    /*
-    ########################### UserDetails API #################################
-     */
-    @Override
-    public Collection<? extends GrantedAuthority> getAuthorities() {
-        //TODO do not create collection on each call
-        return Collections.singleton(new SimpleGrantedAuthority(role.name()));
-    }
-
-    @Override
-    public String getPassword() {
-        return null;
-    }
-
-    @Override
-    public String getUsername() {
-        return getEmail();
-    }
-
-    @Override
-    public boolean isAccountNonExpired() {
-        //unsupported functionality
-        return true;
-    }
-
-    @Override
-    public boolean isAccountNonLocked() {
-        //unsupported functionality
-        return true;
-    }
-
-    @Override
-    public boolean isCredentialsNonExpired() {
-        //unsupported functionality
-        return true;
-    }
-
-    @Override
-    public boolean isEnabled() {
-        return status == Status.ACCEPTED;
-    }
-
-    /*
-    ################# UserDetails API (END) #########################
-     */
-
-
     /**
      * Returns the user's ID.
      *
@@ -194,60 +103,14 @@ public class User implements UserDetails {
      *
      * @return the user's first name
      */
-    public String getFirstName() {
-        return this.firstName;
-    }
-
-    /**
-     * Replaces the user's first name with the new specified value.
-     * If the given name is longer than the maximal allowed number of characters the method throws an exception.
-     *
-     * @param firstName the new first name
-     * @throws IllegalArgumentException when the given name is longer than the maximal allowed number of characters
-     */
-    public void setFirstName(final String firstName) throws IllegalArgumentException {
-        User.log.debug("Setting a new first name: {}", firstName);
-
-        if (firstName == null) {
-            User.log.warn("The given first name must not be null");
-            throw new IllegalArgumentException("first.name.null.error");
-        } else if (firstName.length() > User.NAME_LENGTH) {
-            User.log.warn("The length of the given first name exceeded a limit");
-            throw new IllegalArgumentException("name.length.error");
-        }
-
-        this.firstName = firstName;
-    }
+    public abstract String getFirstName();
 
     /**
      * Returns the user's last name.
      *
      * @return the user's last name
      */
-    public String getLastName() {
-        return this.lastName;
-    }
-
-    /**
-     * Replaces the user's last name with the given one.
-     * If the given name is longer than the maximal allowed number of characters the method throws an exception.
-     *
-     * @param lastName the new last name
-     * @throws IllegalArgumentException when the given name is longer than the maximal allowed number of characters
-     */
-    public void setLastName(final String lastName) throws IllegalArgumentException {
-        User.log.debug("Setting a new last name: {}", lastName);
-
-        if(lastName == null) {
-            User.log.warn("The given last name must not be null");
-            throw new IllegalArgumentException("last.name.null.error");
-        } else if (lastName.length() > User.NAME_LENGTH) {
-            User.log.warn("The length of the given last name exceeded a limit");
-            throw new IllegalArgumentException("name.length.error");
-        }
-
-        this.lastName = lastName;
-    }
+    public abstract String getLastName();
 
     /**
      * Returns the number of user's remaining hours of an overtime.
@@ -461,30 +324,7 @@ public class User implements UserDetails {
      *
      * @return the user's email address
      */
-    public String getEmail() {
-        return this.email;
-    }
-
-    /**
-     * Replaces the user's email address with the new given value.
-     * If the given email is longer than the maximal allowed number of characters the method throws an exception.
-     *
-     * @param email the new email address
-     * @throws IllegalArgumentException when the given email is longer than the maximal allowed number of characters
-     */
-    public void setEmail(final String email) throws IllegalArgumentException {
-        User.log.debug("Setting a new email address: {}", email);
-
-        if (email == null) {
-            User.log.warn("The given email must not be null");
-            throw new IllegalArgumentException("email.null.error");
-        }else if (email.length() > User.EMAIL_ADDRESS_LENGTH) {
-            User.log.warn("The length of the email address exceeded a limit");
-            throw new IllegalArgumentException("email.length.error");
-        }
-
-        this.email = email;
-    }
+    public abstract String getEmail();
 
     /**
      * Returns the URL of a user's photo.
@@ -492,39 +332,18 @@ public class User implements UserDetails {
      * @return the URL of the user's photo
      */
     public String getPhoto() {
-        return this.photo;
+        return DEFAULT_PHOTO;
     }
 
-    /**
-     * Replaces the URL of a user's photo with the given link.
-     *
-     * @param photo the new URL of the user's photo
-     */
-    public void setPhoto(final String photo) {
-        User.log.debug("Setting a new url of a photo: {}", photo);
+    ;
 
-        this.photo = photo == null ? User.DEFAULT_PHOTO : photo;
-    }
 
     /**
      * Returns the date and time of a user's creation.
      *
      * @return the date and time of the user's creation
      */
-    public LocalDateTime getCreationDate() {
-        return this.creationDate;
-    }
-
-    /**
-     * Replaces the user's creation date with the given date and time.
-     *
-     * @param creationDate the new creation date
-     */
-    public void setCreationDate(final LocalDateTime creationDate) {
-        User.log.debug("Setting a new user's creation date: {}", creationDate);
-
-        this.creationDate = creationDate;
-    }
+    public abstract LocalDateTime getCreationDate();
 
     /**
      * Returns the user's role.
@@ -640,19 +459,14 @@ public class User implements UserDetails {
     @Override
     public String toString() {
         return "User{" +
-                "id=" + this.id +
-                ", firstName='" + this.firstName + '\'' +
-                ", lastName='" + this.lastName + '\'' +
-                ", vacationCount=" + this.vacationCount +
-                ", totalSickDayCount=" + this.totalSickDayCount +
-                ", takenSickDayCount=" + this.takenSickDayCount +
-                ", notification=" + this.notification +
-                ", token='" + this.token + '\'' +
-                ", email='" + this.email + '\'' +
-                ", photo='" + this.photo + '\'' +
-                ", creationDate=" + this.creationDate +
-                ", role=" + this.role +
-                ", status=" + this.status +
+                "id=" + id +
+                ", vacationCount=" + vacationCount +
+                ", totalSickDayCount=" + totalSickDayCount +
+                ", takenSickDayCount=" + takenSickDayCount +
+                ", notification=" + notification +
+                ", token='" + token + '\'' +
+                ", role=" + role +
+                ", status=" + status +
                 '}';
     }
 }
\ No newline at end of file
diff --git a/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java b/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java
index d34f81e..a3d9515 100644
--- a/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java
+++ b/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java
@@ -1,9 +1,12 @@
 package org.danekja.ymanager.repository;
 
+import org.danekja.ymanager.domain.RegisteredUser;
 import org.danekja.ymanager.domain.Status;
 import org.danekja.ymanager.domain.User;
 import org.danekja.ymanager.domain.UserRole;
-import org.danekja.ymanager.dto.*;
+import org.danekja.ymanager.dto.BasicProfileUser;
+import org.danekja.ymanager.dto.DefaultSettings;
+import org.danekja.ymanager.dto.FullUserProfile;
 import org.danekja.ymanager.repository.jdbc.mappers.UserRowMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -28,7 +31,7 @@ import static org.danekja.ymanager.domain.UserRole.getUserRole;
 @Repository
 public class UserRepository {
 
-    private final RowMapper<User> USER_MAPPER = new UserRowMapper();
+    private final RowMapper<RegisteredUser> USER_MAPPER = new UserRowMapper();
 
     /**
      * The mapper maps a row from a result of a query to an BasicProfileUser.
@@ -246,8 +249,8 @@ public class UserRepository {
      * @param email email value, used as search key
      * @return found user object or null (if not found)
      */
-    public User getUser(final String email) {
-        List<User> users = this.jdbc.query("SELECT * FROM end_user WHERE email = ?", USER_MAPPER, email);
+    public RegisteredUser getUser(final String email) {
+        List<RegisteredUser> users = this.jdbc.query("SELECT * FROM end_user WHERE email = ?", USER_MAPPER, email);
 
         return RepositoryUtils.singleResult(users);
     }
@@ -258,8 +261,8 @@ public class UserRepository {
      * @param id id value, used as search key
      * @return found user object or null (if not found)
      */
-    public User getUser(final long id) {
-        List<User> users = this.jdbc.query("SELECT * FROM end_user WHERE id = ?", USER_MAPPER, id);
+    public RegisteredUser getUser(final long id) {
+        List<RegisteredUser> users = this.jdbc.query("SELECT * FROM end_user WHERE id = ?", USER_MAPPER, id);
 
         return RepositoryUtils.singleResult(users);
     }
diff --git a/server/src/main/java/org/danekja/ymanager/repository/VacationRepository.java b/server/src/main/java/org/danekja/ymanager/repository/VacationRepository.java
index ca47f5a..cf5dfdc 100644
--- a/server/src/main/java/org/danekja/ymanager/repository/VacationRepository.java
+++ b/server/src/main/java/org/danekja/ymanager/repository/VacationRepository.java
@@ -1,11 +1,9 @@
 package org.danekja.ymanager.repository;
 
-import org.danekja.ymanager.domain.User;
-import org.danekja.ymanager.domain.Vacation;
 import org.danekja.ymanager.domain.Status;
-import org.danekja.ymanager.domain.UserRole;
-import org.danekja.ymanager.dto.VacationDay;
+import org.danekja.ymanager.domain.Vacation;
 import org.danekja.ymanager.domain.VacationType;
+import org.danekja.ymanager.dto.VacationDay;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -163,31 +161,6 @@ public class VacationRepository {
         jdbc.update("DELETE FROM vacation_day WHERE id=?", id);
     }
 
-    public Optional<User> findUserByVacationID(final long id) {
-        return ofNullable(jdbc.queryForObject(
-                "SELECT u.id,u.first_name, u.last_name, u.no_vacations," +
-                        "u.no_sick_days, u.taken_sick_days, u.alert, u.token, u.email," +
-                        "u.photo, u.creation_date, u.user_role, u.status " +
-                "FROM vacation_day v INNER JOIN end_user u ON v.user_id = u.id " +
-                "WHERE v.id = ?", new Object[]{id}, (ResultSet rs, int rowNum)->
-        {
-            User user = new User();
-            user.setId(rs.getLong("u.id"));
-            user.setFirstName(rs.getString("u.first_name"));
-            user.setLastName(rs.getString("u.last_name"));
-            user.setVacationCount(rs.getFloat("u.no_vacations"));
-            user.setTotalSickDayCount(rs.getInt("u.no_sick_days"));
-            user.setTakenSickDayCount(rs.getInt("u.taken_sick_days"));
-            user.setNotification(rs.getTimestamp("u.alert").toLocalDateTime());
-            user.setToken(rs.getString("u.token"));
-            user.setEmail(rs.getString("u.email"));
-            user.setPhoto(rs.getString("u.photo"));
-            user.setCreationDate(rs.getTimestamp("u.creation_date").toLocalDateTime());
-            user.setRole(UserRole.getUserRole(rs.getString("u.user_role")));
-            user.setStatus(getStatus(rs.getString("u.status")));
-            return user;
-        }));
-    }
 
     public boolean isExistVacationForUser(Long userId, LocalDate date) {
         return jdbc.queryForObject("SELECT count(id) AS exist FROM vacation_day WHERE vacation_date = ? AND user_id = ?",
diff --git a/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/UserRowMapper.java b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/UserRowMapper.java
index 60b4d00..bc9c163 100644
--- a/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/UserRowMapper.java
+++ b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/UserRowMapper.java
@@ -1,6 +1,6 @@
 package org.danekja.ymanager.repository.jdbc.mappers;
 
-import org.danekja.ymanager.domain.User;
+import org.danekja.ymanager.domain.RegisteredUser;
 import org.danekja.ymanager.domain.Status;
 import org.danekja.ymanager.domain.UserRole;
 import org.springframework.jdbc.core.RowMapper;
@@ -13,10 +13,10 @@ import java.time.LocalDateTime;
 /**
  * Maps "end_user" query rows into User object.
  */
-public class UserRowMapper implements RowMapper<User> {
+public class UserRowMapper implements RowMapper<RegisteredUser> {
 
     @Override
-    public User mapRow(ResultSet resultSet, int i) throws SQLException {
+    public RegisteredUser mapRow(ResultSet resultSet, int i) throws SQLException {
         Long id = resultSet.getLong("id");
         String firstName = resultSet.getString("first_name");
         String lastName = resultSet.getString("last_name");
@@ -36,6 +36,6 @@ public class UserRowMapper implements RowMapper<User> {
         UserRole role = UserRole.valueOf(resultSet.getString("user_role"));
         Status status = Status.valueOf(resultSet.getString("status"));
 
-        return new User(id, firstName, lastName, vacations, sickDays, takenSickDays, alert, token, email, photo, creationDate, role, status);
+        return new RegisteredUser(id, firstName, lastName, vacations, sickDays, takenSickDays, alert, token, email, photo, creationDate, role, status);
     }
 }
diff --git a/server/src/test/java/org/danekja/ymanager/domain/RegisteredUserTest.java b/server/src/test/java/org/danekja/ymanager/domain/RegisteredUserTest.java
new file mode 100644
index 0000000..f027ad0
--- /dev/null
+++ b/server/src/test/java/org/danekja/ymanager/domain/RegisteredUserTest.java
@@ -0,0 +1,598 @@
+package org.danekja.ymanager.domain;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * This class tests methods of the {@code RegisteredUser} class.
+ * @see RegisteredUser
+ */
+class RegisteredUserTest {
+
+    /**
+     * The empty instance of the {@code RegisteredUser}.
+     */
+    private RegisteredUser user;
+
+    /**
+     * Prepares the instance of the {@code RegisteredUser}.
+     */
+    @BeforeEach
+    void setUp() {
+        this.user = new RegisteredUser();
+        this.user.setVacationCount(0f);
+        this.user.setTotalSickDayCount(0);
+        this.user.setTakenSickDayCount(0);
+    }
+
+    /**
+     * Tests the method {@code setFirstName} with common values where no problem should occur.
+     */
+    @Test
+    void setFirstName_valid() {
+        this.user.setFirstName("aaaaaa");
+        assertEquals("aaaaaa", this.user.getFirstName());
+    }
+
+    /**
+     * Tests the method {@code setFirstName} with the maximal length of a name.
+     */
+    @Test
+    void setFirstName_maxLength_valid() {
+        this.user.setFirstName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+        assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", this.user.getFirstName());
+    }
+
+    /**
+     * Tests the method {@code setFirstName} with name that exceeds maximal length which should throw an exception.
+     */
+    @Test
+    void setFirstName_tooLong() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setFirstName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
+    }
+
+    /**
+     * Tests the method {@code setFirstName} with null input which should throw an exception.
+     */
+    @Test
+    void setFirstName_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setFirstName(null));
+    }
+
+    /**
+     * Tests the method {@code setLastName} with common values where no problem should occur.
+     */
+    @Test
+    void setLastName_valid() {
+        this.user.setLastName("aaaaaa");
+        assertEquals("aaaaaa", this.user.getLastName());
+    }
+
+    /**
+     * Tests the method {@code setLastName} with the maximal length of a name.
+     */
+    @Test
+    void setLastName_maxLength_valid() {
+        this.user.setLastName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+        assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", this.user.getLastName());
+    }
+
+    /**
+     * Tests the method {@code setLastName} with name that exceeds maximal length which should throw an exception.
+     */
+    @Test
+    void setLastName_tooLong() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setLastName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
+    }
+
+    /**
+     * Tests the method {@code setLastName} with null input which should throw an exception.
+     */
+    @Test
+    void setLastName_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setLastName(null));
+    }
+
+    /**
+     * Tests the method {@code setVacationCount} with common values where no problem should occur.
+     */
+    @Test
+    void setVacationCount_valid() {
+        this.user.setVacationCount(10f);
+        assertEquals(10f, this.user.getVacationCount().floatValue());
+    }
+
+    /**
+     * Tests the method {@code setVacationCount} with zero which is a threshold value.
+     */
+    @Test
+    void setVacationCount_zeroInput_valid() {
+        this.user.setVacationCount(0f);
+        assertEquals(0f, this.user.getVacationCount().floatValue());
+    }
+
+    /**
+     * Tests the method {@code setVacationCount} with negative one which is a threshold value.
+     */
+    @Test
+    void setVacationCount_negativeOneInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(-1f));
+    }
+
+    /**
+     * Tests the method {@code setVacationCount} with negative value.
+     */
+    @Test
+    void setVacationCount_negativeInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(-10f));
+    }
+
+    /**
+     * Tests the method {@code setVacationCount} with null value which should throw an exception.
+     */
+    @Test
+    void setVacationCount_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(null));
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with common values where no problem should occur.
+     */
+    @Test
+    void addVacationCount_floatInput_valid() {
+        this.user.addVacationCount(10f);
+        assertEquals(10f, this.user.getVacationCount().floatValue());
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with common values where no problem should occur.
+     */
+    @Test
+    void addVacationCount_addFloatInput_valid() {
+        this.user.setVacationCount(2f);
+        this.user.addVacationCount(10f);
+        assertEquals(12f, this.user.getVacationCount().floatValue());
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with common values where no problem should occur.
+     */
+    @Test
+    void addVacationCount_subtractFloatInput_valid() {
+        this.user.setVacationCount(20f);
+        this.user.addVacationCount(-10f);
+        assertEquals(10f, this.user.getVacationCount().floatValue());
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with negative result of the operation which should throw an exception.
+     */
+    @Test
+    void addVacationCount_floatInput_negativeResult() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(-10f));
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with null value which should throw an exception.
+     */
+    @Test
+    void addVacationCount_nullFloatInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(null));
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with common values where no problem should occur.
+     */
+    @Test
+    void addVacationCount_timeInput_valid() {
+        LocalTime from = LocalTime.of(10,0);
+        LocalTime to = LocalTime.of(20,0);
+        this.user.addVacationCount(from, to);
+        assertEquals(10f, this.user.getVacationCount().floatValue());
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with wrong order of parameters which should throw an exception.
+     */
+    @Test
+    void addVacationCount_timeInput_order() {
+        LocalTime from = LocalTime.of(10,0);
+        LocalTime to = LocalTime.of(20,0);
+        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(to, from));
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with null from parameter which should throw an exception.
+     */
+    @Test
+    void addVacationCount_timeInput_nullFrom() {
+        LocalTime to = LocalTime.of(20,0);
+        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(null, to));
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with null to parameter which should throw an exception.
+     */
+    @Test
+    void addVacationCount_timeInput_nullTo() {
+        LocalTime from = LocalTime.of(20,0);
+        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(from, null));
+    }
+
+    /**
+     * Tests the method {@code addVacationCount} with null parameters which should throw an exception.
+     */
+    @Test
+    void addVacationCount_timeNullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(null, null));
+    }
+
+    /**
+     * Tests the method {@code setTotalSickDayCount} with common values where no problem should occur.
+     */
+    @Test
+    void setTotalSickDayCount_valid() {
+        this.user.setTotalSickDayCount(10);
+        assertEquals(10, this.user.getTotalSickDayCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code setTotalSickDayCount} with zero which is a threshold value.
+     */
+    @Test
+    void setTotalSickDayCount_zeroInput_valid() {
+        this.user.setTotalSickDayCount(0);
+        assertEquals(0, this.user.getTotalSickDayCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code setTotalSickDayCount} with negative one which is a threshold value.
+     */
+    @Test
+    void setTotalSickDayCount_negativeOneInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setTotalSickDayCount(-1));
+    }
+
+    /**
+     * Tests the method {@code setTotalSickDayCount} with negative value.
+     */
+    @Test
+    void setTotalSickDayCount_negativeInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setTotalSickDayCount(-10));
+    }
+
+    /**
+     * Tests the method {@code setTotalSickDayCount} with null value.
+     */
+    @Test
+    void setTotalSickDayCount_nullInput_valid() {
+        this.user.setTotalSickDayCount(null);
+        assertNull(this.user.getTotalSickDayCount());
+    }
+
+    /**
+     * Tests the method {@code setTakenSickDayCount} with common values where no problem should occur.
+     */
+    @Test
+    void setTakenSickDayCount_valid() {
+        this.user.setTotalSickDayCount(20);
+        this.user.setTakenSickDayCount(10);
+        assertEquals(10, this.user.getTakenSickDayCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code setTakenSickDayCount} with zero which is a threshold value.
+     */
+    @Test
+    void setTakenSickDayCount_zeroInput_valid() {
+        this.user.setTakenSickDayCount(0);
+        assertEquals(0, this.user.getTakenSickDayCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code setTakenSickDayCount} with negative one which is a threshold value.
+     */
+    @Test
+    void setTakenSickDayCount_negativeOneInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(-1));
+    }
+
+    /**
+     * Tests the method {@code setTakenSickDayCount} with negative value.
+     */
+    @Test
+    void setTakenSickDayCount_negativeInput() {
+        this.user.setTotalSickDayCount(10);
+        assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(-10));
+    }
+
+    /**
+     * Tests the method {@code setTakenSickDayCount} with a value that is greater than total sick days.
+     */
+    @Test
+    void setTakenSickDayCount_over() {
+        this.user.setTotalSickDayCount(10);
+        assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(20));
+    }
+
+    /**
+     * Tests the method {@code setTakenSickDayCount} with a value that is equals the total sick days.
+     */
+    @Test
+    void setTakenSickDayCount_same() {
+        this.user.setTotalSickDayCount(10);
+        this.user.setTakenSickDayCount(10);
+        assertEquals(10, this.user.getTakenSickDayCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code setTakenSickDayCount} with null value.
+     */
+    @Test
+    void setTakenSickDayCount_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(null));
+    }
+
+    /**
+     * Tests the method {@code addTakenSickDayCount} with common values where no problem should occur.
+     */
+    @Test
+    void addTakenSickDayCount_valid() {
+        this.user.setTotalSickDayCount(50);
+        this.user.addTakenSickDayCount(10);
+        assertEquals(10, this.user.getTakenSickDayCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code addTakenSickDayCount} with common values where no problem should occur.
+     */
+    @Test
+    void addTakenSickDayCount_add_valid() {
+        this.user.setTotalSickDayCount(50);
+        this.user.setTakenSickDayCount(2);
+        this.user.addTakenSickDayCount(10);
+        assertEquals(12f, this.user.getTakenSickDayCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code addTakenSickDayCount} with common values where no problem should occur.
+     */
+    @Test
+    void addTakenSickDayCount_subtract_valid() {
+        this.user.setTotalSickDayCount(50);
+        this.user.setTakenSickDayCount(20);
+        this.user.addTakenSickDayCount(-10);
+        assertEquals(10f, this.user.getTakenSickDayCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code addTakenSickDayCount} with negative result of the operation which should throw an exception.
+     */
+    @Test
+    void addTakenSickDayCount_negativeResult() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.addTakenSickDayCount(-10));
+    }
+
+    /**
+     * Tests the method {@code addTakenSickDayCount} with null value which should throw an exception.
+     */
+    @Test
+    void addTakenSickDayCount_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.addTakenSickDayCount(null));
+    }
+
+    /**
+     * Tests the method {@code addTakenSickDayCount} with a value that is greater than total sick days.
+     */
+    @Test
+    void addTakenSickDayCount_over() {
+        this.user.setTotalSickDayCount(10);
+        assertThrows(IllegalArgumentException.class, () -> this.user.addTakenSickDayCount(20));
+    }
+
+    /**
+     * Tests the method {@code addTakenSickDayCount} with a value that is equals the total sick days.
+     */
+    @Test
+    void addTakenSickDayCount_same() {
+        this.user.setTotalSickDayCount(10);
+        this.user.addTakenSickDayCount(10);
+        assertEquals(10, this.user.getTakenSickDayCount().intValue());
+    }
+
+
+    /**
+     * Tests the method {@code setNotification} with common values where no problem should occur.
+     */
+    @Test
+    void setNotification_valid() {
+        this.user.setNotification(LocalDateTime.of(2010,5,1,20,0));
+        assertEquals(LocalDateTime.of(2010,5,1,20,0), this.user.getNotification());
+    }
+
+    /**
+     * Tests the method {@code setNotification} with null value.
+     */
+    @Test
+    void setNotification_nullInput_valid() {
+        this.user.setNotification(null);
+        assertNull(this.user.getNotification());
+    }
+
+    /**
+     * Tests the method {@code setToken} with common values where no problem should occur.
+     */
+    @Test
+    void setToken_valid() {
+        this.user.setToken("aaaaa");
+        assertEquals("aaaaa", this.user.getToken());
+    }
+
+    /**
+     * Tests the method {@code setToken} with null value.
+     */
+    @Test
+    void setToken_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setToken(null));
+    }
+
+    /**
+     * Tests the method {@code setEmail} with common values where no problem should occur.
+     */
+    @Test
+    void setEmail_valid() {
+        this.user.setEmail("aaaaaa");
+        assertEquals("aaaaaa", this.user.getEmail());
+    }
+
+    /**
+     * Tests the method {@code setEmail} with the maximal length of an email address.
+     */
+    @Test
+    void setEmail_maxLength() {
+        this.user.setEmail("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+        assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", this.user.getEmail());
+    }
+
+    /**
+     * Tests the method {@code setEmail} with email address that exceeds maximal length which should throw an exception.
+     */
+    @Test
+    void setEmail_tooLong() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setEmail("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
+    }
+
+    /**
+     * Tests the method {@code setEmail} with null value.
+     */
+    @Test
+    void setEmail_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setEmail(null));
+    }
+
+    /**
+     * Tests the method {@code setPhoto} with common values where no problem should occur.
+     */
+    @Test
+    void setPhoto_valid() {
+        this.user.setPhoto("aaaaa");
+        assertEquals("aaaaa", this.user.getPhoto());
+    }
+
+    /**
+     * Tests the method {@code setPhoto} with null value.
+     */
+    @Test
+    void setPhoto_nullInput_valid() {
+        this.user.setPhoto(null);
+        assertEquals("https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg", this.user.getPhoto());
+    }
+
+    /**
+     * Tests the method {@code setRole} with common values where no problem should occur.
+     */
+    @Test
+    void setRole_valid() {
+        this.user.setRole(UserRole.EMPLOYER);
+        assertEquals(UserRole.EMPLOYER, this.user.getRole());
+    }
+
+    /**
+     * Tests the method {@code setRole} with null value.
+     */
+    @Test
+    void setRole_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setRole(null));
+    }
+
+    /**
+     * Tests the method {@code setStatus} with common values where no problem should occur.
+     */
+    @Test
+    void setStatus_valid() {
+        this.user.setStatus(Status.ACCEPTED);
+        assertEquals(Status.ACCEPTED, this.user.getStatus());
+    }
+
+    /**
+     * Tests the method {@code setStatus} with null value.
+     */
+    @Test
+    void setStatus_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setStatus(null));
+    }
+
+    /**
+     * Tests the method {@code takeVacation} with common values where no problem should occur.
+     */
+    @Test
+    void takeVacation_valid() {
+        this.user.setVacationCount(10f);
+        this.user.takeVacation(LocalTime.of(15,0), LocalTime.of(20, 0));
+        assertEquals(5, this.user.getVacationCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code takeVacation} when there is not enough vacations.
+     */
+    @Test
+    void takeVacation_notEnough() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(LocalTime.of(15,0), LocalTime.of(20, 0)));
+    }
+
+    /**
+     * Tests the method {@code takeVacation} with switched from and to parameters.
+     */
+    @Test
+    void takeVacation_order() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation( LocalTime.of(20,0), LocalTime.of(10,0)));
+    }
+
+    /**
+     * Tests the method {@code takeVacation} with from argument null.
+     */
+    @Test
+    void takeVacation_nullFrom() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(null, LocalTime.of(15,0)));
+    }
+
+    /**
+     * Tests the method {@code takeVacation} with to argument null.
+     */
+    @Test
+    void takeVacation_nullTo() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(LocalTime.of(15,0), null));
+    }
+
+    /**
+     * Tests the method {@code takeVacation } with both arguments null.
+     */
+    @Test
+    void takeVacation_nullBoth() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(null, null));
+    }
+
+    /**
+     * Tests the method {@code takeVacation} with common values where no problem should occur.
+     */
+    @Test
+    void takeSickDay_valid() {
+        this.user.setTotalSickDayCount(5);
+        this.user.takeSickDay();
+        assertEquals(1, this.user.getTakenSickDayCount().intValue());
+    }
+
+    /**
+     * Tests the method {@code takeVacation} when there is not enough available sick days.
+     */
+    @Test
+    void takeSickDay_notEnough() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeSickDay());
+    }
+
+}
diff --git a/server/src/test/java/org/danekja/ymanager/domain/UserTest.java b/server/src/test/java/org/danekja/ymanager/domain/UserTest.java
deleted file mode 100644
index 4dad2f6..0000000
--- a/server/src/test/java/org/danekja/ymanager/domain/UserTest.java
+++ /dev/null
@@ -1,619 +0,0 @@
-package org.danekja.ymanager.domain;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-/**
- * This class tests methods of the {@code User} class.
- * @see User
- */
-class UserTest {
-
-    /**
-     * The empty instance of the {@code User}.
-     */
-    private User user;
-
-    /**
-     * Prepares the instance of the {@code User}.
-     */
-    @BeforeEach
-    void setUp() {
-        this.user = new User();
-        this.user.setVacationCount(0f);
-        this.user.setTotalSickDayCount(0);
-        this.user.setTakenSickDayCount(0);
-    }
-
-    /**
-     * Tests the method {@code setFirstName} with common values where no problem should occur.
-     */
-    @Test
-    void setFirstName_valid() {
-        this.user.setFirstName("aaaaaa");
-        assertEquals("aaaaaa", this.user.getFirstName());
-    }
-
-    /**
-     * Tests the method {@code setFirstName} with the maximal length of a name.
-     */
-    @Test
-    void setFirstName_maxLength_valid() {
-        this.user.setFirstName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
-        assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", this.user.getFirstName());
-    }
-
-    /**
-     * Tests the method {@code setFirstName} with name that exceeds maximal length which should throw an exception.
-     */
-    @Test
-    void setFirstName_tooLong() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setFirstName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
-    }
-
-    /**
-     * Tests the method {@code setFirstName} with null input which should throw an exception.
-     */
-    @Test
-    void setFirstName_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setFirstName(null));
-    }
-
-    /**
-     * Tests the method {@code setLastName} with common values where no problem should occur.
-     */
-    @Test
-    void setLastName_valid() {
-        this.user.setLastName("aaaaaa");
-        assertEquals("aaaaaa", this.user.getLastName());
-    }
-
-    /**
-     * Tests the method {@code setLastName} with the maximal length of a name.
-     */
-    @Test
-    void setLastName_maxLength_valid() {
-        this.user.setLastName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
-        assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", this.user.getLastName());
-    }
-
-    /**
-     * Tests the method {@code setLastName} with name that exceeds maximal length which should throw an exception.
-     */
-    @Test
-    void setLastName_tooLong() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setLastName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
-    }
-
-    /**
-     * Tests the method {@code setLastName} with null input which should throw an exception.
-     */
-    @Test
-    void setLastName_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setLastName(null));
-    }
-
-    /**
-     * Tests the method {@code setVacationCount} with common values where no problem should occur.
-     */
-    @Test
-    void setVacationCount_valid() {
-        this.user.setVacationCount(10f);
-        assertEquals(10f, this.user.getVacationCount().floatValue());
-    }
-
-    /**
-     * Tests the method {@code setVacationCount} with zero which is a threshold value.
-     */
-    @Test
-    void setVacationCount_zeroInput_valid() {
-        this.user.setVacationCount(0f);
-        assertEquals(0f, this.user.getVacationCount().floatValue());
-    }
-
-    /**
-     * Tests the method {@code setVacationCount} with negative one which is a threshold value.
-     */
-    @Test
-    void setVacationCount_negativeOneInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(-1f));
-    }
-
-    /**
-     * Tests the method {@code setVacationCount} with negative value.
-     */
-    @Test
-    void setVacationCount_negativeInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(-10f));
-    }
-
-    /**
-     * Tests the method {@code setVacationCount} with null value which should throw an exception.
-     */
-    @Test
-    void setVacationCount_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(null));
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with common values where no problem should occur.
-     */
-    @Test
-    void addVacationCount_floatInput_valid() {
-        this.user.addVacationCount(10f);
-        assertEquals(10f, this.user.getVacationCount().floatValue());
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with common values where no problem should occur.
-     */
-    @Test
-    void addVacationCount_addFloatInput_valid() {
-        this.user.setVacationCount(2f);
-        this.user.addVacationCount(10f);
-        assertEquals(12f, this.user.getVacationCount().floatValue());
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with common values where no problem should occur.
-     */
-    @Test
-    void addVacationCount_subtractFloatInput_valid() {
-        this.user.setVacationCount(20f);
-        this.user.addVacationCount(-10f);
-        assertEquals(10f, this.user.getVacationCount().floatValue());
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with negative result of the operation which should throw an exception.
-     */
-    @Test
-    void addVacationCount_floatInput_negativeResult() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(-10f));
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with null value which should throw an exception.
-     */
-    @Test
-    void addVacationCount_nullFloatInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(null));
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with common values where no problem should occur.
-     */
-    @Test
-    void addVacationCount_timeInput_valid() {
-        LocalTime from = LocalTime.of(10,0);
-        LocalTime to = LocalTime.of(20,0);
-        this.user.addVacationCount(from, to);
-        assertEquals(10f, this.user.getVacationCount().floatValue());
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with wrong order of parameters which should throw an exception.
-     */
-    @Test
-    void addVacationCount_timeInput_order() {
-        LocalTime from = LocalTime.of(10,0);
-        LocalTime to = LocalTime.of(20,0);
-        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(to, from));
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with null from parameter which should throw an exception.
-     */
-    @Test
-    void addVacationCount_timeInput_nullFrom() {
-        LocalTime to = LocalTime.of(20,0);
-        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(null, to));
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with null to parameter which should throw an exception.
-     */
-    @Test
-    void addVacationCount_timeInput_nullTo() {
-        LocalTime from = LocalTime.of(20,0);
-        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(from, null));
-    }
-
-    /**
-     * Tests the method {@code addVacationCount} with null parameters which should throw an exception.
-     */
-    @Test
-    void addVacationCount_timeNullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.addVacationCount(null, null));
-    }
-
-    /**
-     * Tests the method {@code setTotalSickDayCount} with common values where no problem should occur.
-     */
-    @Test
-    void setTotalSickDayCount_valid() {
-        this.user.setTotalSickDayCount(10);
-        assertEquals(10, this.user.getTotalSickDayCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code setTotalSickDayCount} with zero which is a threshold value.
-     */
-    @Test
-    void setTotalSickDayCount_zeroInput_valid() {
-        this.user.setTotalSickDayCount(0);
-        assertEquals(0, this.user.getTotalSickDayCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code setTotalSickDayCount} with negative one which is a threshold value.
-     */
-    @Test
-    void setTotalSickDayCount_negativeOneInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setTotalSickDayCount(-1));
-    }
-
-    /**
-     * Tests the method {@code setTotalSickDayCount} with negative value.
-     */
-    @Test
-    void setTotalSickDayCount_negativeInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setTotalSickDayCount(-10));
-    }
-
-    /**
-     * Tests the method {@code setTotalSickDayCount} with null value.
-     */
-    @Test
-    void setTotalSickDayCount_nullInput_valid() {
-        this.user.setTotalSickDayCount(null);
-        assertNull(this.user.getTotalSickDayCount());
-    }
-
-    /**
-     * Tests the method {@code setTakenSickDayCount} with common values where no problem should occur.
-     */
-    @Test
-    void setTakenSickDayCount_valid() {
-        this.user.setTotalSickDayCount(20);
-        this.user.setTakenSickDayCount(10);
-        assertEquals(10, this.user.getTakenSickDayCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code setTakenSickDayCount} with zero which is a threshold value.
-     */
-    @Test
-    void setTakenSickDayCount_zeroInput_valid() {
-        this.user.setTakenSickDayCount(0);
-        assertEquals(0, this.user.getTakenSickDayCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code setTakenSickDayCount} with negative one which is a threshold value.
-     */
-    @Test
-    void setTakenSickDayCount_negativeOneInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(-1));
-    }
-
-    /**
-     * Tests the method {@code setTakenSickDayCount} with negative value.
-     */
-    @Test
-    void setTakenSickDayCount_negativeInput() {
-        this.user.setTotalSickDayCount(10);
-        assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(-10));
-    }
-
-    /**
-     * Tests the method {@code setTakenSickDayCount} with a value that is greater than total sick days.
-     */
-    @Test
-    void setTakenSickDayCount_over() {
-        this.user.setTotalSickDayCount(10);
-        assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(20));
-    }
-
-    /**
-     * Tests the method {@code setTakenSickDayCount} with a value that is equals the total sick days.
-     */
-    @Test
-    void setTakenSickDayCount_same() {
-        this.user.setTotalSickDayCount(10);
-        this.user.setTakenSickDayCount(10);
-        assertEquals(10, this.user.getTakenSickDayCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code setTakenSickDayCount} with null value.
-     */
-    @Test
-    void setTakenSickDayCount_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(null));
-    }
-
-    /**
-     * Tests the method {@code addTakenSickDayCount} with common values where no problem should occur.
-     */
-    @Test
-    void addTakenSickDayCount_valid() {
-        this.user.setTotalSickDayCount(50);
-        this.user.addTakenSickDayCount(10);
-        assertEquals(10, this.user.getTakenSickDayCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code addTakenSickDayCount} with common values where no problem should occur.
-     */
-    @Test
-    void addTakenSickDayCount_add_valid() {
-        this.user.setTotalSickDayCount(50);
-        this.user.setTakenSickDayCount(2);
-        this.user.addTakenSickDayCount(10);
-        assertEquals(12f, this.user.getTakenSickDayCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code addTakenSickDayCount} with common values where no problem should occur.
-     */
-    @Test
-    void addTakenSickDayCount_subtract_valid() {
-        this.user.setTotalSickDayCount(50);
-        this.user.setTakenSickDayCount(20);
-        this.user.addTakenSickDayCount(-10);
-        assertEquals(10f, this.user.getTakenSickDayCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code addTakenSickDayCount} with negative result of the operation which should throw an exception.
-     */
-    @Test
-    void addTakenSickDayCount_negativeResult() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.addTakenSickDayCount(-10));
-    }
-
-    /**
-     * Tests the method {@code addTakenSickDayCount} with null value which should throw an exception.
-     */
-    @Test
-    void addTakenSickDayCount_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.addTakenSickDayCount(null));
-    }
-
-    /**
-     * Tests the method {@code addTakenSickDayCount} with a value that is greater than total sick days.
-     */
-    @Test
-    void addTakenSickDayCount_over() {
-        this.user.setTotalSickDayCount(10);
-        assertThrows(IllegalArgumentException.class, () -> this.user.addTakenSickDayCount(20));
-    }
-
-    /**
-     * Tests the method {@code addTakenSickDayCount} with a value that is equals the total sick days.
-     */
-    @Test
-    void addTakenSickDayCount_same() {
-        this.user.setTotalSickDayCount(10);
-        this.user.addTakenSickDayCount(10);
-        assertEquals(10, this.user.getTakenSickDayCount().intValue());
-    }
-
-
-    /**
-     * Tests the method {@code setNotification} with common values where no problem should occur.
-     */
-    @Test
-    void setNotification_valid() {
-        this.user.setNotification(LocalDateTime.of(2010,5,1,20,0));
-        assertEquals(LocalDateTime.of(2010,5,1,20,0), this.user.getNotification());
-    }
-
-    /**
-     * Tests the method {@code setNotification} with null value.
-     */
-    @Test
-    void setNotification_nullInput_valid() {
-        this.user.setNotification(null);
-        assertNull(this.user.getNotification());
-    }
-
-    /**
-     * Tests the method {@code setToken} with common values where no problem should occur.
-     */
-    @Test
-    void setToken_valid() {
-        this.user.setToken("aaaaa");
-        assertEquals("aaaaa", this.user.getToken());
-    }
-
-    /**
-     * Tests the method {@code setToken} with null value.
-     */
-    @Test
-    void setToken_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setToken(null));
-    }
-
-    /**
-     * Tests the method {@code setEmail} with common values where no problem should occur.
-     */
-    @Test
-    void setEmail_valid() {
-        this.user.setEmail("aaaaaa");
-        assertEquals("aaaaaa", this.user.getEmail());
-    }
-
-    /**
-     * Tests the method {@code setEmail} with the maximal length of an email address.
-     */
-    @Test
-    void setEmail_maxLength() {
-        this.user.setEmail("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
-        assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", this.user.getEmail());
-    }
-
-    /**
-     * Tests the method {@code setEmail} with email address that exceeds maximal length which should throw an exception.
-     */
-    @Test
-    void setEmail_tooLong() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setEmail("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
-    }
-
-    /**
-     * Tests the method {@code setEmail} with null value.
-     */
-    @Test
-    void setEmail_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setEmail(null));
-    }
-
-    /**
-     * Tests the method {@code setPhoto} with common values where no problem should occur.
-     */
-    @Test
-    void setPhoto_valid() {
-        this.user.setPhoto("aaaaa");
-        assertEquals("aaaaa", this.user.getPhoto());
-    }
-
-    /**
-     * Tests the method {@code setPhoto} with null value.
-     */
-    @Test
-    void setPhoto_nullInput_valid() {
-        this.user.setPhoto(null);
-        assertEquals("https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg", this.user.getPhoto());
-    }
-
-    /**
-     * Tests the method {@code setRole} with common values where no problem should occur.
-     */
-    @Test
-    void setRole_valid() {
-        this.user.setRole(UserRole.EMPLOYER);
-        assertEquals(UserRole.EMPLOYER, this.user.getRole());
-    }
-
-    /**
-     * Tests the method {@code setRole} with null value.
-     */
-    @Test
-    void setRole_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setRole(null));
-    }
-
-    /**
-     * Tests the method {@code setStatus} with common values where no problem should occur.
-     */
-    @Test
-    void setStatus_valid() {
-        this.user.setStatus(Status.ACCEPTED);
-        assertEquals(Status.ACCEPTED, this.user.getStatus());
-    }
-
-    /**
-     * Tests the method {@code setStatus} with null value.
-     */
-    @Test
-    void setStatus_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setStatus(null));
-    }
-
-    /**
-     * Tests the method {@code takeVacation} with common values where no problem should occur.
-     */
-    @Test
-    void takeVacation_valid() {
-        this.user.setVacationCount(10f);
-        this.user.takeVacation(LocalTime.of(15,0), LocalTime.of(20, 0));
-        assertEquals(5, this.user.getVacationCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code takeVacation} when there is not enough vacations.
-     */
-    @Test
-    void takeVacation_notEnough() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(LocalTime.of(15,0), LocalTime.of(20, 0)));
-    }
-
-    /**
-     * Tests the method {@code takeVacation} with switched from and to parameters.
-     */
-    @Test
-    void takeVacation_order() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation( LocalTime.of(20,0), LocalTime.of(10,0)));
-    }
-
-    /**
-     * Tests the method {@code takeVacation} with from argument null.
-     */
-    @Test
-    void takeVacation_nullFrom() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(null, LocalTime.of(15,0)));
-    }
-
-    /**
-     * Tests the method {@code takeVacation} with to argument null.
-     */
-    @Test
-    void takeVacation_nullTo() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(LocalTime.of(15,0), null));
-    }
-
-    /**
-     * Tests the method {@code takeVacation } with both arguments null.
-     */
-    @Test
-    void takeVacation_nullBoth() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(null, null));
-    }
-
-    /**
-     * Tests the method {@code takeVacation} with common values where no problem should occur.
-     */
-    @Test
-    void takeSickDay_valid() {
-        this.user.setTotalSickDayCount(5);
-        this.user.takeSickDay();
-        assertEquals(1, this.user.getTakenSickDayCount().intValue());
-    }
-
-    /**
-     * Tests the method {@code takeVacation} when there is not enough available sick days.
-     */
-    @Test
-    void takeSickDay_notEnough() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.takeSickDay());
-    }
-
-    /**
-     * Tests the method {@code toString}.
-     */
-    @Test
-    void testToString() {
-        User user = new User();
-        user.setId(5L);
-        user.setFirstName("Jan");
-        user.setLastName("Nov\u00E1k");
-        user.setVacationCount(0f);
-        user.setTotalSickDayCount(10);
-        user.setTakenSickDayCount(5);
-        user.setNotification(LocalDateTime.of(2008,10,30,20,0));
-        user.setToken("tokenContent");
-        user.setEmail("novak@email.com");
-        user.setPhoto("url");
-        user.setCreationDate(LocalDateTime.of(2010,7,31,12,5));
-        user.setRole(UserRole.EMPLOYER);
-        user.setStatus(Status.ACCEPTED);
-        assertEquals("User{id=5, firstName='Jan', lastName='Nov\u00E1k', vacationCount=0.0, totalSickDayCount=10, takenSickDayCount=5, notification=2008-10-30T20:00, token='tokenContent', email='novak@email.com', photo='url', creationDate=2010-07-31T12:05, role=EMPLOYER, status=ACCEPTED}", user.toString());
-    }
-}
