commit 6b50e2ca99a1097378249413d704b94528711158
Author: D0miq <dpoch@email.com>
Date:   Tue Jun 4 15:20:53 2019 +0200

    Handle different or non inputs, unit tests, error messages

diff --git a/server/init.sql b/server/init.sql
index 694afea..3d01f8e 100644
--- a/server/init.sql
+++ b/server/init.sql
@@ -65,6 +65,7 @@ CREATE PROCEDURE GetUserId(
   OUT out_no_sick_days INT,
   OUT out_taken_sick_days INT,
   OUT out_alert DATETIME,
+  OUT out_token TEXT,
   OUT out_email VARCHAR(100),
   OUT out_photo TEXT,
   OUT out_creation_date DATETIME,
@@ -75,8 +76,8 @@ BEGIN
   DECLARE notification DATETIME;
 
   SELECT no_sick_days, alert INTO sickDaysCount, notification FROM default_settings ORDER BY id DESC LIMIT 1;
-  SELECT id, first_name, last_name, no_vacations, IFNULL(no_sick_days, sickDaysCount), taken_sick_days, IFNULL(alert, notification), email, photo, creation_date, user_role, status
-     INTO out_id, out_first_name, out_last_name, out_no_vacations, out_no_sick_days, out_taken_sick_days, out_alert, out_email, out_photo, out_creation_date, out_role, out_status
+  SELECT id, first_name, last_name, no_vacations, IFNULL(no_sick_days, sickDaysCount), taken_sick_days, IFNULL(alert, notification), token, email, photo, creation_date, user_role, status
+     INTO out_id, out_first_name, out_last_name, out_no_vacations, out_no_sick_days, out_taken_sick_days, out_alert, out_token, out_email, out_photo, out_creation_date, out_role, out_status
      FROM end_user
      WHERE id=in_id;
 END $$
@@ -91,6 +92,7 @@ CREATE PROCEDURE GetUserToken(
   OUT out_no_sick_days INT,
   OUT out_taken_sick_days INT,
   OUT out_alert DATETIME,
+  OUT out_token TEXT,
   OUT out_email VARCHAR(100),
   OUT out_photo TEXT,
   OUT out_creation_date DATETIME,
@@ -101,8 +103,8 @@ BEGIN
   DECLARE notification DATETIME;
 
   SELECT no_sick_days, alert INTO sickDaysCount, notification FROM default_settings ORDER BY id DESC LIMIT 1;
-  SELECT id, first_name, last_name, no_vacations, IFNULL(no_sick_days, sickDaysCount), taken_sick_days, IFNULL(alert, notification), email, photo, creation_date, user_role, status
-     INTO out_id, out_first_name, out_last_name, out_no_vacations, out_no_sick_days, out_taken_sick_days, out_alert, out_email, out_photo, out_creation_date, out_role, out_status
+  SELECT id, first_name, last_name, no_vacations, IFNULL(no_sick_days, sickDaysCount), taken_sick_days, IFNULL(alert, notification), token, email, photo, creation_date, user_role, status
+     INTO out_id, out_first_name, out_last_name, out_no_vacations, out_no_sick_days, out_taken_sick_days, out_alert, out_token, out_email, out_photo, out_creation_date, out_role, out_status
      FROM end_user
      WHERE token=in_token;
 END $$
@@ -112,9 +114,9 @@ DELIMITER ;
 -- -----------------------------------------------------
 -- Insert table end_user
 -- -----------------------------------------------------
-INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES ('admin', 'admin', 0, NULL, 0, NULL, '', '', '', 'employer', 'accepted');
-INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES ('Jan', 'Novák', 0, 10, 0, '2019-12-6 16:30:00.000', '', '', '', 'employee', 'pending');
-INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES ('Josef', 'Svoboda', 2, NULL, 3, NULL, '', '', '', 'employee', 'rejected');
+INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES ('admin', 'admin', 0, NULL, 0, NULL, '', '', '', 'EMPLOYER', 'ACCEPTED');
+INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES ('Jan', 'Novák', 0, 10, 0, '2019-12-6 16:30:00.000', '', '', '', 'EMPLOYEE', 'PENDING');
+INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES ('Josef', 'Svoboda', 2, NULL, 3, NULL, '', '', '', 'EMPLOYEE', 'REJECTED');
 
 -- -----------------------------------------------------
 -- Insert table vacation_day
diff --git a/server/src/main/java/cz/zcu/yamanager/business/ApiManager.java b/server/src/main/java/cz/zcu/yamanager/business/ApiManager.java
index 402211a..0282643 100644
--- a/server/src/main/java/cz/zcu/yamanager/business/ApiManager.java
+++ b/server/src/main/java/cz/zcu/yamanager/business/ApiManager.java
@@ -1,5 +1,6 @@
 package cz.zcu.yamanager.business;
 
+import cz.zcu.yamanager.domain.User;
 import cz.zcu.yamanager.dto.*;
 import cz.zcu.yamanager.repository.RequestRepository;
 import cz.zcu.yamanager.repository.UserRepository;
@@ -28,7 +29,7 @@ public class ApiManager implements Manager {
      */
     private static final Logger log = LoggerFactory.getLogger(UserRepository.class);
 
-    private static final int DAYS_IN_WEEK = 7;
+    private static final int WEEK_LENGTH = 7;
 
     private RequestRepository requestRepository;
     private UserRepository userRepository;
@@ -51,14 +52,13 @@ public class ApiManager implements Manager {
         }
 
         LocalDate today = LocalDate.now();
-        LocalDate weekBefore = today.minusDays(ApiManager.DAYS_IN_WEEK);
-        LocalDate weekAfter = today.plusDays(ApiManager.DAYS_IN_WEEK);
+        LocalDate weekBefore = today.minusDays(ApiManager.WEEK_LENGTH);
+        LocalDate weekAfter = today.plusDays(ApiManager.WEEK_LENGTH);
         for (BasicProfileUser user : users) {
             user.setCalendar(this.vacationRepository.getVacationDays(user.getId(), weekBefore, weekAfter));
         }
 
         return users;
-
     }
 
     @Override
@@ -114,36 +114,49 @@ public class ApiManager implements Manager {
 
     @Override
     public void createSettings(DefaultSettings settings) throws RESTFullException {
-        this.userRepository.insertSettings(settings);
+        this.userRepository.insertSettings(new cz.zcu.yamanager.domain.DefaultSettings(settings.getSickDayCount(), settings.getNotification()));
     }
 
     @Override
     public void createVacation(Long userId, VacationDay vacationDay) throws RESTFullException {
-        UserRole role = this.userRepository.getUserRole(userId);
-        vacationDay.setStatus(role == UserRole.EMPLOYER ? Status.ACCEPTED : Status.PENDING);
+        cz.zcu.yamanager.domain.VacationDay vacation = new cz.zcu.yamanager.domain.VacationDay(vacationDay.getDate(), vacationDay.getFrom(), vacationDay.getTo(), vacationDay.getStatus(), vacationDay.getType());
+
+        User user = this.userRepository.getUser(userId);
+        vacation.setStatus(user.getRole() == UserRole.EMPLOYER ? Status.ACCEPTED : Status.PENDING);
 
-        if(vacationDay.getType() == VacationType.VACATION) {
-            this.userRepository.decreaseVacationCount(userId, vacationDay.getFrom().until(vacationDay.getTo(), MINUTES) / 60f);
+        if(vacation.getType() == VacationType.VACATION) {
+            user.takeVacation(vacation.getFrom(), vacation.getTo());
         } else {
-            this.userRepository.increaseTakenSickdays(userId);
+            user.takeSickDay();
         }
 
-        this.vacationRepository.insertVacationDay(userId, vacationDay);
+        this.vacationRepository.insertVacationDay(userId, vacation);
+        this.userRepository.updateUser(user);
     }
 
     @Override
     public void changeSettings(Long userId, UserSettings settings) throws RESTFullException {
-        settings.setId(userId);
+        User user = this.userRepository.getUser(userId);
+
         if(settings.getRole() == null && settings.getSickDayCount() == null && settings.getVacationCount() == null) {
-            this.userRepository.updateNotification(settings);
+            user.setNotification(settings.getNotification());
         } else {
-            this.userRepository.updateUserSettings(settings);
+            user.setVacationCount(settings.getVacationCount());
+            user.setTotalSickDayCount(settings.getSickDayCount());
+            user.setRole(settings.getRole());
         }
+
+        this.userRepository.updateUser(user);
     }
 
     @Override
     public void changeVacation(Long userId, VacationDay vacationDay) throws RESTFullException {
-        this.vacationRepository.updateVacationDay(vacationDay);
+        cz.zcu.yamanager.domain.VacationDay vacation = this.vacationRepository.getVacationDay(vacationDay.getId());
+        vacation.setDate(vacationDay.getDate());
+        vacation.setStatus(vacationDay.getStatus());
+        vacation.setType(vacationDay.getType());
+        vacation.setTime(vacationDay.getFrom(), vacationDay.getTo());
+        this.vacationRepository.updateVacationDay(vacation);
     }
 
     @Override
diff --git a/server/src/main/java/cz/zcu/yamanager/business/mock/ManagerMock.java b/server/src/main/java/cz/zcu/yamanager/business/mock/ManagerMock.java
index 608986a..cf345f5 100644
--- a/server/src/main/java/cz/zcu/yamanager/business/mock/ManagerMock.java
+++ b/server/src/main/java/cz/zcu/yamanager/business/mock/ManagerMock.java
@@ -47,7 +47,7 @@ public class ManagerMock implements Manager {
         vacationDay.setStatus(status);
 
         switch (vacationType) {
-            case SICKDAY: {
+            case SICK_DAY: {
                 vacationDay.setFrom(null);
                 vacationDay.setTo(null);
             } break;
@@ -72,7 +72,7 @@ public class ManagerMock implements Manager {
         request.setTimestamp(LocalDateTime.now());
 
         switch (vacationType) {
-            case SICKDAY: {
+            case SICK_DAY: {
                 request.setFrom(null);
                 request.setTo(null);
             } break;
diff --git a/server/src/main/java/cz/zcu/yamanager/domain/DefaultSettings.java b/server/src/main/java/cz/zcu/yamanager/domain/DefaultSettings.java
index 917efcf..feaa8b6 100644
--- a/server/src/main/java/cz/zcu/yamanager/domain/DefaultSettings.java
+++ b/server/src/main/java/cz/zcu/yamanager/domain/DefaultSettings.java
@@ -41,6 +41,17 @@ public class DefaultSettings {
         this.id = 0;
     }
 
+    /**
+     * Creates a new default settings with the specified number of available sick days, date and time of a notification.
+     *
+     * @param sickDayCount the default number of available sick days
+     * @param notification the default date and time of sending an email warning about an incoming reset of remaining overtimes and sick days
+     * @throws IllegalArgumentException when the given sickDayCount value is negative
+     */
+    public DefaultSettings(final Integer sickDayCount, final LocalDateTime notification) throws IllegalArgumentException {
+        this(0, sickDayCount, notification);
+    }
+
     /**
      * Creates a new default settings with the specified id, number of available sick days, date and time of a notification.
      *
@@ -49,13 +60,13 @@ public class DefaultSettings {
      * @param notification the default date and time of sending an email warning about an incoming reset of remaining overtimes and sick days
      * @throws IllegalArgumentException when the given sickDayCount value is negative
      */
-    public DefaultSettings(final long id, final int sickDayCount, final LocalDateTime notification) throws IllegalArgumentException {
-        DefaultSettings.log.trace("Creating a new instance of the class DefaultSettings.");
+    public DefaultSettings(final long id, final Integer sickDayCount, final LocalDateTime notification) throws IllegalArgumentException {
+        DefaultSettings.log.trace("Creating a new instance of the class DefaultSettings");
         DefaultSettings.log.debug("DefaultSettings: id={}, sickDayCount={}, notification={}", id, sickDayCount, notification);
 
         this.id = id;
         this.setSickDayCount(sickDayCount);
-        this.notification = notification;
+        this.setNotification(notification);
     }
 
     /**
@@ -78,16 +89,19 @@ public class DefaultSettings {
 
     /**
      * Replaces the default number of available sick days in this default settings with the given one.
-     * If the given number is negative the method throws an exception.
+     * If the given number is negative or null the method throws an exception.
      *
      * @param sickDayCount the new default number of available sick days
-     * @throws IllegalArgumentException when the given value is negative
+     * @throws IllegalArgumentException when the given value is negative or null
      */
-    public void setSickDayCount(final int sickDayCount) throws IllegalArgumentException {
-        DefaultSettings.log.debug("Setting a new number of available sick days: {}.", sickDayCount);
-
-        if (sickDayCount < 0) {
-            DefaultSettings.log.warn("The number of available sick days was negative.");
+    public void setSickDayCount(final Integer sickDayCount) {
+        DefaultSettings.log.debug("Setting a new number of available sick days: {}", sickDayCount);
+
+        if (sickDayCount == null) {
+            DefaultSettings.log.warn("The given number of available sick days must not be null");
+            throw new IllegalArgumentException("sick.day.null.error");
+        } else if (sickDayCount < 0) {
+            DefaultSettings.log.warn("The number of available sick days was negative");
             throw new IllegalArgumentException("sick.day.count.error");
         }
 
@@ -105,11 +119,19 @@ public class DefaultSettings {
 
     /**
      * Replaces the default date and time of sending an email warning about an incoming reset of remaining overtimes and sick days with the specified one.
+     * If the given notification is null the method throws an exception.
      *
      * @param notification the new default date and time
+     * @throws IllegalArgumentException when the given notification is null
      */
-    public void setNotification(final LocalDateTime notification) {
-        DefaultSettings.log.debug("Setting a new default date and time of sending an email warning: {}.", notification);
+    public void setNotification(final LocalDateTime notification) throws IllegalArgumentException {
+        DefaultSettings.log.debug("Setting a new default date and time of sending an email warning: {}", notification);
+
+        if (notification == null) {
+            DefaultSettings.log.warn("The notification must not be null");
+            throw new IllegalArgumentException("notification.null.error");
+        }
+
         this.notification = notification;
     }
 
diff --git a/server/src/main/java/cz/zcu/yamanager/domain/User.java b/server/src/main/java/cz/zcu/yamanager/domain/User.java
index eaa3a56..254a54c 100644
--- a/server/src/main/java/cz/zcu/yamanager/domain/User.java
+++ b/server/src/main/java/cz/zcu/yamanager/domain/User.java
@@ -6,6 +6,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.time.LocalDateTime;
+import java.time.LocalTime;
+
+import static java.time.temporal.ChronoUnit.MINUTES;
 
 /**
  * The domain class {@code User} represents a single record in the 'end_user' table of a database.
@@ -99,11 +102,31 @@ public class User {
     public User() {
         User.log.trace("Creating a new instance of the class User.");
         this.id = 0;
-        this.creationDate = LocalDateTime.now();
+        this.creationDate = null;
+    }
+
+    /**
+     * Creates a new user and sets attributes known during an insertion.
+     *
+     * @param firstName         the user's first name
+     * @param lastName          the user's last name.
+     * @param vacationCount     the number of user's remaining hours of an overtime
+     * @param totalSickDayCount the number of user's sick days available during a year
+     * @param takenSickDayCount the number of user's taken sick days
+     * @param notification      the date and time of sending an email warning about an incoming reset of remaining overtimes and sick days
+     * @param token             the token for the Google oAuth
+     * @param email             the user's email address
+     * @param photo             the URL of a user's photo
+     * @param role              the user's role
+     * @param status            the user's authorization status
+     * @throws IllegalArgumentException when the vacationCount, totalSickDayCount or takenSickDayCount are negative or first name, last name or email exceed the maximal permitted number of characters
+     */
+    public User(final String firstName, final String lastName, final Float vacationCount, final Integer totalSickDayCount, final Integer takenSickDayCount, final LocalDateTime notification, final String token, final String email, final String photo, final UserRole role, final Status status) throws IllegalArgumentException {
+        this(0, firstName, lastName, vacationCount, totalSickDayCount, takenSickDayCount, notification, token, email, photo, null, role, status);
     }
 
     /**
-     * Creates a new user and sets all its attributes.
+     * Creates a new user and sets all his/hers attributes.
      *
      * @param id                the user's ID
      * @param firstName         the user's first name
@@ -120,7 +143,7 @@ public class User {
      * @param status            the user's authorization status
      * @throws IllegalArgumentException when the vacationCount, totalSickDayCount or takenSickDayCount are negative or first name, last name or email exceed the maximal permitted number of characters
      */
-    public User(final long id, final String firstName, final String lastName, final float vacationCount, final int totalSickDayCount, final int takenSickDayCount, final LocalDateTime notification, final String token, final String email, final String photo, final LocalDateTime creationDate, final UserRole role, final Status status) throws IllegalArgumentException {
+    public User(final long id, final String firstName, final String lastName, final Float vacationCount, final Integer totalSickDayCount, final Integer takenSickDayCount, final LocalDateTime notification, final String token, final String email, final String photo, final LocalDateTime creationDate, final UserRole role, final Status status) throws IllegalArgumentException {
         User.log.trace("Creating a new instance of the class User.");
         User.log.debug("User: id={}, firstName={}, lastName={}, vacationCount={}, totalSickDayCount={}, takenSickDayCount={}, notification={}, token={}, email={}, photo={}, creationDate={}, role={}, status={}", id, firstName, lastName, vacationCount, totalSickDayCount, takenSickDayCount, notification, token, email, photo, creationDate, role, status);
 
@@ -130,13 +153,13 @@ public class User {
         this.setVacationCount(vacationCount);
         this.setTotalSickDayCount(totalSickDayCount);
         this.setTakenSickDayCount(takenSickDayCount);
-        this.notification = notification;
+        this.setNotification(notification);
         this.token = token;
         this.setEmail(email);
         this.photo = photo;
         this.creationDate = creationDate;
-        this.role = role;
-        this.status = status;
+        this.setRole(role);
+        this.setStatus(status);
     }
 
     /**
@@ -168,7 +191,7 @@ public class User {
         User.log.debug("Setting a new first name: {}", firstName);
 
         if (firstName.length() > User.NAME_LENGTH) {
-            User.log.warn("The length of the given first name exceeded the limit.");
+            User.log.warn("The length of the given first name exceeded a limit");
             throw new IllegalArgumentException("name.length.error");
         }
 
@@ -195,7 +218,7 @@ public class User {
         User.log.debug("Setting a new last name: {}", lastName);
 
         if (lastName.length() > User.NAME_LENGTH) {
-            User.log.warn("The length of the given last name exceeded the limit.");
+            User.log.warn("The length of the given last name exceeded a limit");
             throw new IllegalArgumentException("name.length.error");
         }
 
@@ -213,50 +236,25 @@ public class User {
 
     /**
      * Replaces the number of user's remaining hours of an overtime with the specified value.
-     * If the given number is negative the method throws an exception.
+     * If the given number is negative or null the method throws an exception.
      *
      * @param vacationCount the new number of remaining hours of the overtime.
      * @throws IllegalArgumentException when the given value is negative
      */
-    public void setVacationCount(final float vacationCount) throws IllegalArgumentException {
+    public void setVacationCount(final Float vacationCount) throws IllegalArgumentException {
         User.log.debug("Setting a new number of remaining overtime: {}", vacationCount);
 
-        if (vacationCount < 0) {
-            User.log.warn("The given number of remaining overtime must not be negative.");
-            throw new IllegalArgumentException("vacation.count.error");
+        if(vacationCount == null) {
+            User.log.warn("The number of remaining overtime must not be null");
+            throw new IllegalArgumentException("vacation.null.error");
+        }else if (vacationCount < 0) {
+            User.log.warn("The number of remaining overtime must not be negative");
+            throw new IllegalArgumentException("negative.vacation.error");
         }
 
         this.vacationCount = vacationCount;
     }
 
-    /**
-     * Increases the number of user's remaining hours of an overtime by the given amount.
-     *
-     * @param amount the amount of hours
-     */
-    public void increaseVacationCount(final float amount) {
-        User.log.debug("Increasing the number of remaining overtime by {}", amount);
-        this.vacationCount += amount;
-    }
-
-    /**
-     * Decreases the number of user's remaining hours of an overtime by the given amount.
-     * If the new number of remaining hours is below zero the method throws an exception.
-     *
-     * @param amount the amount of hours
-     * @throws IllegalArgumentException when the result of the subtraction is negative
-     */
-    public void decreaseVacationCount(final float amount) throws IllegalArgumentException {
-        User.log.debug("Decreasing the number of remaining overtime by {}", amount);
-
-        if (this.vacationCount - amount < 0) {
-            User.log.warn("The result of the decrease must not be negative.");
-            throw new IllegalArgumentException("vacation.count.error");
-        }
-
-        this.vacationCount -= amount;
-    }
-
     /**
      * Returns the number of user's sick days available during a year.
      *
@@ -268,17 +266,20 @@ public class User {
 
     /**
      * Replaces the number of user's sick days available during a year with the new value.
-     * If the given number is negative the method throws an exception.
+     * If the given number is negative or null the method throws an exception.
      *
      * @param totalSickDayCount the new number of sick days available during the year
      * @throws IllegalArgumentException when the given value is negative
      */
-    public void setTotalSickDayCount(final int totalSickDayCount) throws IllegalArgumentException {
+    public void setTotalSickDayCount(final Integer totalSickDayCount) throws IllegalArgumentException {
         User.log.debug("Setting a new number of user's sick days available during a year: {}", totalSickDayCount);
 
-        if (totalSickDayCount < 0) {
-            User.log.warn("The given number of user's sick days available during a year must not be negative.");
-            throw new IllegalArgumentException("sick.day.count.error");
+        if (totalSickDayCount == null) {
+            User.log.warn("The number of user's available sick days must not be null");
+            throw new IllegalArgumentException("sick.day.null.error");
+        } else if (totalSickDayCount < 0) {
+            User.log.warn("The number of user's available sick days must not be negative");
+            throw new IllegalArgumentException("negative.sick.day.error");
         }
 
         this.totalSickDayCount = totalSickDayCount;
@@ -295,17 +296,23 @@ public class User {
 
     /**
      * Replaces the number of user's taken sick days with the new value.
-     * If the given number is negative the method throws an exception.
+     * If the given number is negative or greater than the number of available sick days or null the method throws an exception.
      *
      * @param takenSickDayCount the new number of taken sick days
      * @throws IllegalArgumentException when the given value is negative
      */
-    public void setTakenSickDayCount(final int takenSickDayCount) throws IllegalArgumentException {
+    public void setTakenSickDayCount(final Integer takenSickDayCount) throws IllegalArgumentException {
         User.log.debug("Setting a new number of user's taken sick days: {}", takenSickDayCount);
 
-        if (takenSickDayCount < 0) {
-            User.log.warn("The given number number of user's taken sick days must not be negative.");
-            throw new IllegalArgumentException("sick.day.count.error");
+        if (takenSickDayCount == null) {
+            User.log.warn("The number number of user's taken sick days must not be null");
+            throw new IllegalArgumentException("sick.day.null.error");
+        } else if (takenSickDayCount < 0) {
+            User.log.warn("The number number of user's taken sick days must not be negative");
+            throw new IllegalArgumentException("negative.sick.day.error");
+        } else if(takenSickDayCount > this.totalSickDayCount){
+            User.log.warn("The number number of user's taken sick days must not greater than his/her available sick days");
+            throw new IllegalArgumentException("taken.sick.day.count.error");
         }
 
         this.takenSickDayCount = takenSickDayCount;
@@ -322,11 +329,19 @@ public class User {
 
     /**
      * Replaces the date and time of sending an email warning about an incoming reset of remaining overtimes and sick days with the given value.
+     * If the given notification is null the method throws an exception.
      *
      * @param notification the new date and time
+     * @throws IllegalArgumentException when the given notification is null
      */
-    public void setNotification(final LocalDateTime notification) {
+    public void setNotification(final LocalDateTime notification) throws IllegalArgumentException {
         User.log.debug("Setting a new date and time of sending an email warning: {}", notification);
+
+        if(notification == null) {
+            User.log.warn("The given notification must not be null");
+            throw new IllegalArgumentException("notification.null.error");
+        }
+
         this.notification = notification;
     }
 
@@ -369,7 +384,7 @@ public class User {
         User.log.debug("Setting a new email address: {}", email);
 
         if (email.length() > User.EMAIL_ADDRESS_LENGTH) {
-            User.log.warn("The length of the email address exceeded the limit.");
+            User.log.warn("The length of the email address exceeded a limit");
             throw new IllegalArgumentException("email.length.error");
         }
 
@@ -415,11 +430,19 @@ public class User {
 
     /**
      * Replaces the user's role with the new provided value.
+     * If the given role is null the method throws an exception.
      *
      * @param role the new role
+     * @throws IllegalArgumentException when the given role is null
      */
-    public void setRole(final UserRole role) {
+    public void setRole(final UserRole role) throws IllegalArgumentException {
         User.log.debug("Setting a new user's role: {}", role);
+
+        if(role == null) {
+            User.log.warn("The given role must not be null");
+            throw new IllegalArgumentException("role.null.error");
+        }
+
         this.role = role;
     }
 
@@ -439,9 +462,65 @@ public class User {
      */
     public void setStatus(final Status status) {
         User.log.debug("Setting a new authorization status: {}", status);
+
+        if(status == null) {
+            User.log.warn("The given status must not be null");
+            throw new IllegalArgumentException("status.null.error");
+        }
+
         this.status = status;
     }
 
+    /**
+     * Subtracts a difference of the given starting and the ending time of a vacation
+     * from the number of user's available vacations. If some of the given parameters are null
+     * or the times are not in order or there is no available vacation left the method throws an exception.
+     *
+     * @param from the starting time of a vacation
+     * @param to the ending time of a vacation
+     * @throws IllegalArgumentException when some of the given parameters are null
+     *          or the times are not in order or there is no available vacation left
+     */
+    public void takeVacation(final LocalTime from, final LocalTime to) throws IllegalArgumentException{
+        User.log.debug("Taking a vacation from {} to {}", from, to);
+
+        if(from == null || to == null) {
+            User.log.warn("A vacation has to have a starting and an ending time");
+            throw new IllegalArgumentException("time.vacation.error");
+        } else if (from.compareTo(to) >= 0) {
+            User.log.warn("A vacation must not start after it ends. from={}, to={}", from, to);
+            throw new IllegalArgumentException("time.order.error");
+        }
+
+        final float difference = from.until(to, MINUTES) / 60f;
+        final float tempVacationCount = this.vacationCount - difference;
+
+        if (tempVacationCount < 0) {
+            User.log.warn("Cannot take a vacation, not enough available hours");
+            throw new IllegalArgumentException("available.vacation.error");
+        }
+
+        this.vacationCount = tempVacationCount;
+    }
+
+    /**
+     * Increases the number of taken sick days by one unless there are not any available sick days left. In that case
+     * the method throws and exception.
+     *
+     * @throws IllegalArgumentException when there is not any available sick days left
+     */
+    public void takeSickDay() throws  IllegalArgumentException {
+        User.log.trace("Taking a sick day");
+        final int tempTakenSickDayCount = ++this.takenSickDayCount;
+
+        if (tempTakenSickDayCount > this.totalSickDayCount) {
+            User.log.warn("Cannot take a sick day, not enough available days");
+            throw new IllegalArgumentException("available.sick.day.error");
+        }
+
+        this.takenSickDayCount = tempTakenSickDayCount;
+    }
+
     /**
      * Gets a string representation of this user. The representation contains the id, first name, last name,
      * number of user's remaining hours of an overtime, number of user's sick days available during a year,
diff --git a/server/src/main/java/cz/zcu/yamanager/domain/VacationDay.java b/server/src/main/java/cz/zcu/yamanager/domain/VacationDay.java
index b3a87b8..32f357c 100644
--- a/server/src/main/java/cz/zcu/yamanager/domain/VacationDay.java
+++ b/server/src/main/java/cz/zcu/yamanager/domain/VacationDay.java
@@ -23,7 +23,7 @@ public class VacationDay {
     /**
      * The ID of this vacation.
      */
-    private final int id;
+    private final long id;
 
     /**
      * The date of this vacation.
@@ -73,8 +73,8 @@ public class VacationDay {
      * @param creationDate the date and time of the creation of the sick day
      * @param status       the approval status of the sick day
      */
-    public VacationDay(final int id, final LocalDate date, final LocalDateTime creationDate, final Status status) {
-        this(id, date, null, null, creationDate, status, VacationType.SICKDAY);
+    public VacationDay(final long id, final LocalDate date, final LocalDateTime creationDate, final Status status) {
+        this(id, date, null, null, creationDate, status, VacationType.SICK_DAY);
     }
 
     /**
@@ -87,10 +87,23 @@ public class VacationDay {
      * @param creationDate the date and time of the creation of the overtime
      * @param status       the approval status of the overtime
      */
-    public VacationDay(final int id, final LocalDate date, final LocalTime from, final LocalTime to, final LocalDateTime creationDate, final Status status) {
+    public VacationDay(final long id, final LocalDate date, final LocalTime from, final LocalTime to, final LocalDateTime creationDate, final Status status) {
         this(id, date, from, to, creationDate, status, VacationType.VACATION);
     }
 
+    /**
+     * Creates a new overtime or sick day with attributes known during insertion.
+     *
+     * @param date         the date of a vacation
+     * @param from         the starting time of a vacation
+     * @param to           the ending time of a vacation
+     * @param status       the approval status of a vacation
+     * @param type         the type of a vacation
+     */
+    public VacationDay(final LocalDate date, final LocalTime from, final LocalTime to, final Status status, final VacationType type) {
+        this(0, date, from, to, null, status, type);
+    }
+
     /**
      * Creates a new overtime or sick day with all attributes.
      *
@@ -102,16 +115,16 @@ public class VacationDay {
      * @param status       the approval status of a vacation
      * @param type         the type of a vacation
      */
-    private VacationDay(final int id, final LocalDate date, final LocalTime from, final LocalTime to, final LocalDateTime creationDate, final Status status, final VacationType type) {
+    public VacationDay(final long id, final LocalDate date, final LocalTime from, final LocalTime to, final LocalDateTime creationDate, final Status status, final VacationType type) {
         VacationDay.log.trace("Creating a new instance of the class VacationDay.");
         VacationDay.log.debug("VacationDay: id={}, date={}, from={}, to={}, creationDate={}, status={}, type={}", id, date, from, to, creationDate, status, type);
 
         this.id = id;
-        this.date = date;
+        this.setDate(date);
+        this.setType(type);
         this.setTime(from, to);
         this.creationDate = creationDate;
-        this.status = status;
-        this.type = type;
+        this.setStatus(status);
     }
 
     /**
@@ -119,7 +132,7 @@ public class VacationDay {
      *
      * @return the ID of this vacation
      */
-    public int getId() {
+    public long getId() {
         return this.id;
     }
 
@@ -134,11 +147,19 @@ public class VacationDay {
 
     /**
      * Replaces the date of this vacation with the specified date.
+     * If the given date is null the method throws an exception.
      *
      * @param date the new date
+     * @throws IllegalArgumentException when the given date is null
      */
-    public void setDate(final LocalDate date) {
+    public void setDate(final LocalDate date) throws IllegalArgumentException {
         VacationDay.log.debug("Settings a new value of a date: {}", date);
+
+        if (date == null) {
+            VacationDay.log.warn("The given date must not be null.");
+            throw new IllegalArgumentException("date.null.error");
+        }
+
         this.date = date;
     }
 
@@ -161,8 +182,14 @@ public class VacationDay {
     public void setFrom(final LocalTime from) throws IllegalArgumentException {
         VacationDay.log.debug("Settings a new value of the starting time of this vacation: {}", from);
 
-        if (from != null && this.to != null && from.compareTo(this.to) >= 0) {
-            VacationDay.log.warn("The vacation must not start after it ends. from={}, to={}", from, this.to);
+        if (from != null && this.type == VacationType.SICK_DAY) {
+            VacationDay.log.warn("A sick day must not have a starting or an ending time");
+            throw new IllegalArgumentException("time.sick.day.error");
+        } else if(from == null && this.type == VacationType.VACATION) {
+            VacationDay.log.warn("A vacation has to have a starting and an ending time");
+            throw new IllegalArgumentException("time.vacation.error");
+        } else if (from != null && this.to != null && from.compareTo(this.to) >= 0) {
+            VacationDay.log.warn("A vacation must not start after it ends. from={}, to={}", from, this.to);
             throw new IllegalArgumentException("time.order.error");
         }
 
@@ -188,8 +215,14 @@ public class VacationDay {
     public void setTo(final LocalTime to) throws IllegalArgumentException {
         VacationDay.log.debug("Settings a new value of the ending time of this vacation: {}", to);
 
-        if (to != null && this.from != null && to.compareTo(this.from) <= 0) {
-            VacationDay.log.warn("The vacation must not end after it starts. from={}, to={}", this.from, to);
+        if (to != null && this.type == VacationType.SICK_DAY) {
+            VacationDay.log.warn("A sick day must not have a starting or an ending time");
+            throw new IllegalArgumentException("time.sick_day.error");
+        } else if(to == null && this.type == VacationType.VACATION) {
+            VacationDay.log.warn("A vacation has to have a starting and an ending time");
+            throw new IllegalArgumentException("time.vacation.error");
+        } else if (to != null && this.from != null && to.compareTo(this.from) <= 0) {
+            VacationDay.log.warn("A vacation must not end after it starts. from={}, to={}", this.from, to);
             throw new IllegalArgumentException("time.order.error");
         }
 
@@ -207,8 +240,14 @@ public class VacationDay {
     public void setTime(final LocalTime from, final LocalTime to) throws IllegalArgumentException {
         VacationDay.log.debug("Settings a new value of the starting {} and the ending {} time of this vacation.", from, to);
 
-        if (from != null && to != null && from.compareTo(to) >= 0) {
-            VacationDay.log.warn("The vacation must not start after it ends. from={}, to={}", from, to);
+        if ((from != null || to != null) && this.type == VacationType.SICK_DAY) {
+            VacationDay.log.warn("A sick day must not have a starting or an ending time");
+            throw new IllegalArgumentException("time.sick.day_error");
+        } else if((from == null || to == null) && this.type == VacationType.VACATION) {
+            VacationDay.log.warn("A vacation has to have a starting and an ending time");
+            throw new IllegalArgumentException("time.vacation.error");
+        } else if (from != null && to != null && from.compareTo(to) >= 0) {
+            VacationDay.log.warn("A vacation must not start after it ends. from={}, to={}", from, to);
             throw new IllegalArgumentException("time.order.error");
         }
 
@@ -236,11 +275,19 @@ public class VacationDay {
 
     /**
      * Replaces the approval status of this vacation with the given value.
+     * If the given status is null the method throws an exception.
      *
      * @param status the new approval status
+     * @throws IllegalArgumentException when the given status is null
      */
-    public void setStatus(final Status status) {
+    public void setStatus(final Status status) throws IllegalArgumentException {
         VacationDay.log.debug("Setting a new approval status: {}", status);
+
+        if (status == null) {
+            VacationDay.log.warn("The given status must not be null");
+            throw new IllegalArgumentException("status.null.error");
+        }
+
         this.status = status;
     }
 
@@ -255,12 +302,23 @@ public class VacationDay {
 
     /**
      * Replaces the type of this vacation with the handed type.
-     * If the given type is a SICKDAY the method sets the starting and the ending time to null.
+     * If the given type is SICK_DAY the method sets the starting and the ending time to null.
+     * If the given type is null the method throws an exception.
      *
      * @param type the new type
+     * @throws IllegalArgumentException when the given type is null
      */
-    public void setType(final VacationType type) {
+    public void setType(final VacationType type) throws IllegalArgumentException {
         VacationDay.log.debug("Setting a new type of this vacation: {}", type);
+
+        if(type == VacationType.SICK_DAY) {
+            this.from = null;
+            this.to = null;
+        } else if (type == null) {
+            VacationDay.log.warn("The given type of a vacation must not be null");
+            throw new IllegalArgumentException("type.null.error");
+        }
+
         this.type = type;
     }
 
diff --git a/server/src/main/java/cz/zcu/yamanager/dto/VacationType.java b/server/src/main/java/cz/zcu/yamanager/dto/VacationType.java
index c8aed06..53a2b09 100644
--- a/server/src/main/java/cz/zcu/yamanager/dto/VacationType.java
+++ b/server/src/main/java/cz/zcu/yamanager/dto/VacationType.java
@@ -7,7 +7,7 @@ public enum VacationType {
     /**
      * The vacation represents a sick day.
      */
-    SICKDAY,
+    SICK_DAY,
 
     /**
      * The vacation represents an overtime.
diff --git a/server/src/main/java/cz/zcu/yamanager/repository/RequestRepository.java b/server/src/main/java/cz/zcu/yamanager/repository/RequestRepository.java
index 576f7c0..0049e1e 100644
--- a/server/src/main/java/cz/zcu/yamanager/repository/RequestRepository.java
+++ b/server/src/main/java/cz/zcu/yamanager/repository/RequestRepository.java
@@ -112,15 +112,6 @@ public class RequestRepository {
         this.updateAuthorization(request.getId(), request.getStatus());
     }
 
-    /**
-     * Updates the status of an authorization request from the given AuthorizationRequest object.
-     *
-     * @param request the AuthorizationRequest object with new values of the authorization request
-     */
-    public void updateAuthorization(final AuthorizationRequest request) {
-        this.updateAuthorization(request.getId(), request.getStatus());
-    }
-
     /**
      * Gets all vacation requests from a database. Method returns all vacation requests despite
      * its authorization status. It returns accepted, pending even rejected vacations.
@@ -231,13 +222,4 @@ public class RequestRepository {
     public void updateVacationRequest(final BasicRequest request) {
         this.updateVacationRequest(request.getId(), request.getStatus());
     }
-
-    /**
-     * Updates a status of a vacation request from a VacationRequest object.
-     *
-     * @param request the VacationRequest object with new values of the vacation request
-     */
-    public void updateVacationRequest(final VacationRequest request) {
-        this.updateAuthorization(request.getId(), request.getStatus());
-    }
 }
diff --git a/server/src/main/java/cz/zcu/yamanager/repository/UserRepository.java b/server/src/main/java/cz/zcu/yamanager/repository/UserRepository.java
index 07d56f0..369c41b 100644
--- a/server/src/main/java/cz/zcu/yamanager/repository/UserRepository.java
+++ b/server/src/main/java/cz/zcu/yamanager/repository/UserRepository.java
@@ -1,5 +1,6 @@
 package cz.zcu.yamanager.repository;
 
+import cz.zcu.yamanager.domain.User;
 import cz.zcu.yamanager.dto.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,6 +41,82 @@ public class UserRepository {
         this.jdbc = jdbc;
     }
 
+    private Map<String, Object> getUserColumns(final long id) {
+        final List<SqlParameter> paramList = new ArrayList<>();
+        paramList.add(new SqlParameter("in_id", Types.BIGINT));
+        paramList.add(new SqlOutParameter("out_id", Types.BIGINT));
+        paramList.add(new SqlOutParameter("out_first_name", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_last_name", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_no_vacations", Types.FLOAT));
+        paramList.add(new SqlOutParameter("out_no_sick_days", Types.INTEGER));
+        paramList.add(new SqlOutParameter("out_taken_sick_days", Types.INTEGER));
+        paramList.add(new SqlOutParameter("out_alert", Types.TIMESTAMP));
+        paramList.add(new SqlOutParameter("out_token", Types.LONGVARCHAR));
+        paramList.add(new SqlOutParameter("out_email", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_photo", Types.LONGVARCHAR));
+        paramList.add(new SqlOutParameter("out_creation_date", Types.TIMESTAMP));
+        paramList.add(new SqlOutParameter("out_role", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_status", Types.VARCHAR));
+
+        return jdbc.call(con -> {
+            final CallableStatement callableStatement = con.prepareCall("{call GetUserId(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
+            callableStatement.setLong(1, id);
+            callableStatement.registerOutParameter(2, Types.BIGINT);
+            callableStatement.registerOutParameter(3, Types.VARCHAR);
+            callableStatement.registerOutParameter(4, Types.VARCHAR);
+            callableStatement.registerOutParameter(5, Types.FLOAT);
+            callableStatement.registerOutParameter(6, Types.INTEGER);
+            callableStatement.registerOutParameter(7, Types.INTEGER);
+            callableStatement.registerOutParameter(8, Types.TIMESTAMP);
+            callableStatement.registerOutParameter(9, Types.LONGVARCHAR);
+            callableStatement.registerOutParameter(10, Types.VARCHAR);
+            callableStatement.registerOutParameter(11, Types.LONGVARCHAR);
+            callableStatement.registerOutParameter(12, Types.TIMESTAMP);
+            callableStatement.registerOutParameter(13, Types.VARCHAR);
+            callableStatement.registerOutParameter(14, Types.VARCHAR);
+            return callableStatement;
+        }, paramList);
+    }
+
+    private Map<String, Object> getUserColumns(final String token) {
+        final List<SqlParameter> paramList = new ArrayList<>();
+        paramList.add(new SqlParameter(Types.LONGVARCHAR));
+        paramList.add(new SqlOutParameter("out_id", Types.BIGINT));
+        paramList.add(new SqlOutParameter("out_first_name", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_last_name", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_no_vacations", Types.FLOAT));
+        paramList.add(new SqlOutParameter("out_no_sick_days", Types.INTEGER));
+        paramList.add(new SqlOutParameter("out_taken_sick_days", Types.INTEGER));
+        paramList.add(new SqlOutParameter("out_alert", Types.TIMESTAMP));
+        paramList.add(new SqlOutParameter("out_token", Types.LONGVARCHAR));
+        paramList.add(new SqlOutParameter("out_email", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_photo", Types.LONGVARCHAR));
+        paramList.add(new SqlOutParameter("out_creation_date", Types.TIMESTAMP));
+        paramList.add(new SqlOutParameter("out_role", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_status", Types.VARCHAR));
+
+        return jdbc.call(con -> {
+            final CallableStatement callableStatement = con.prepareCall("{call GetUserToken(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
+            callableStatement.setString(1, token);
+            callableStatement.registerOutParameter(2, Types.BIGINT);
+            callableStatement.registerOutParameter(3, Types.VARCHAR);
+            callableStatement.registerOutParameter(4, Types.VARCHAR);
+            callableStatement.registerOutParameter(5, Types.FLOAT);
+            callableStatement.registerOutParameter(6, Types.INTEGER);
+            callableStatement.registerOutParameter(7, Types.INTEGER);
+            callableStatement.registerOutParameter(8, Types.TIMESTAMP);
+            callableStatement.registerOutParameter(9, Types.LONGVARCHAR);
+            callableStatement.registerOutParameter(10, Types.VARCHAR);
+            callableStatement.registerOutParameter(11, Types.LONGVARCHAR);
+            callableStatement.registerOutParameter(12, Types.TIMESTAMP);
+            callableStatement.registerOutParameter(13, Types.VARCHAR);
+            callableStatement.registerOutParameter(14, Types.VARCHAR);
+            return callableStatement;
+        }, paramList);
+    }
+
+    //---------------------------------- DTO -----------------------------------
+
     /**
      * Gets basic profile of each user from a database. The basic profile contains default, the most important
      * informations which helps identify a user like a name or photo. Every line of output is converted to a BasicProfileUser
@@ -90,41 +167,9 @@ public class UserRepository {
      * @return
      */
     public FullUserProfile getFullUser(final long id) {
-        UserRepository.log.trace("Selecting full profiles of a user with a specified id from a database ");
-        UserRepository.log.debug("Id: {}", id);
-
-        final List<SqlParameter> paramList = new ArrayList<>();
-        paramList.add(new SqlParameter("in_id", Types.BIGINT));
-        paramList.add(new SqlOutParameter("out_id", Types.BIGINT));
-        paramList.add(new SqlOutParameter("out_first_name", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_last_name", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_no_vacations", Types.FLOAT));
-        paramList.add(new SqlOutParameter("out_no_sick_days", Types.INTEGER));
-        paramList.add(new SqlOutParameter("out_taken_sick_days", Types.INTEGER));
-        paramList.add(new SqlOutParameter("out_alert", Types.TIMESTAMP));
-        paramList.add(new SqlOutParameter("out_email", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_photo", Types.LONGVARCHAR));
-        paramList.add(new SqlOutParameter("out_creation_date", Types.TIMESTAMP));
-        paramList.add(new SqlOutParameter("out_role", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_status", Types.VARCHAR));
+        UserRepository.log.debug("Selecting full profile of a user with the specified id from a database: {}", id);
 
-        final Map<String, Object> resultMap = jdbc.call(con -> {
-            final CallableStatement callableStatement = con.prepareCall("{call GetUserId(?,?,?,?,?,?,?,?,?,?,?,?,?)}");
-            callableStatement.setLong(1, id);
-            callableStatement.registerOutParameter(2, Types.BIGINT);
-            callableStatement.registerOutParameter(3, Types.VARCHAR);
-            callableStatement.registerOutParameter(4, Types.VARCHAR);
-            callableStatement.registerOutParameter(5, Types.FLOAT);
-            callableStatement.registerOutParameter(6, Types.INTEGER);
-            callableStatement.registerOutParameter(7, Types.INTEGER);
-            callableStatement.registerOutParameter(8, Types.TIMESTAMP);
-            callableStatement.registerOutParameter(9, Types.VARCHAR);
-            callableStatement.registerOutParameter(10, Types.LONGNVARCHAR);
-            callableStatement.registerOutParameter(11, Types.TIMESTAMP);
-            callableStatement.registerOutParameter(12, Types.VARCHAR);
-            callableStatement.registerOutParameter(13, Types.VARCHAR);
-            return callableStatement;
-        }, paramList);
+        final Map<String, Object> resultMap = this.getUserColumns(id);
 
         final FullUserProfile user = new FullUserProfile();
         user.setId(id);
@@ -134,7 +179,7 @@ public class UserRepository {
         user.setSickDayCount((Integer) resultMap.get("out_no_sick_days"));
         user.setTakenSickDayCount((Integer) resultMap.get("out_taken_sick_days"));
         user.setNotification(((Timestamp) resultMap.get("out_alert")).toLocalDateTime());
-        user.setEmail((String) resultMap.get(("out_email")));
+        user.setEmail((String) resultMap.get("out_email"));
         user.setPhoto((String) resultMap.get("out_photo"));
         user.setRole(UserRole.getUserRole((String) resultMap.get("out_role")));
         user.setStatus(Status.getStatus((String) resultMap.get("out_status")));
@@ -142,47 +187,10 @@ public class UserRepository {
 
     }
 
-    public UserRole getUserRole(final long id) {
-        return this.jdbc.queryForObject("SELECT user_role FROM end_user WHERE id = ?", new Object[]{id}, (ResultSet rs, int rowNum) -> UserRole.getUserRole(rs.getString("status")));
-    }
-
-    public Status getUserStatus(final long id) {
-        return this.jdbc.queryForObject("SELECT status FROM end_user WHERE id = ?", new Object[]{id}, (ResultSet rs, int rowNum) -> Status.getStatus(rs.getString("status")));
-    }
-
     public FullUserProfile getFullUser(final String token) {
-        final List<SqlParameter> paramList = new ArrayList<>();
-        paramList.add(new SqlParameter(Types.LONGNVARCHAR));
-        paramList.add(new SqlOutParameter("out_id", Types.BIGINT));
-        paramList.add(new SqlOutParameter("out_first_name", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_last_name", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_no_vacations", Types.FLOAT));
-        paramList.add(new SqlOutParameter("out_no_sick_days", Types.INTEGER));
-        paramList.add(new SqlOutParameter("out_taken_sick_days", Types.INTEGER));
-        paramList.add(new SqlOutParameter("out_alert", Types.TIMESTAMP));
-        paramList.add(new SqlOutParameter("out_email", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_photo", Types.LONGVARCHAR));
-        paramList.add(new SqlOutParameter("out_creation_date", Types.TIMESTAMP));
-        paramList.add(new SqlOutParameter("out_role", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_status", Types.VARCHAR));
+        UserRepository.log.trace("Selecting full profile of a user with the specified token from a database: {}", token);
 
-        final Map<String, Object> resultMap = jdbc.call(con -> {
-            final CallableStatement callableStatement = con.prepareCall("{call GetUserToken(?,?,?,?,?,?,?,?,?,?,?,?,?)}");
-            callableStatement.setString(1, token);
-            callableStatement.registerOutParameter(2, Types.BIGINT);
-            callableStatement.registerOutParameter(3, Types.VARCHAR);
-            callableStatement.registerOutParameter(4, Types.VARCHAR);
-            callableStatement.registerOutParameter(5, Types.FLOAT);
-            callableStatement.registerOutParameter(6, Types.INTEGER);
-            callableStatement.registerOutParameter(7, Types.INTEGER);
-            callableStatement.registerOutParameter(8, Types.TIMESTAMP);
-            callableStatement.registerOutParameter(9, Types.VARCHAR);
-            callableStatement.registerOutParameter(10, Types.LONGNVARCHAR);
-            callableStatement.registerOutParameter(11, Types.TIMESTAMP);
-            callableStatement.registerOutParameter(12, Types.VARCHAR);
-            callableStatement.registerOutParameter(13, Types.VARCHAR);
-            return callableStatement;
-        }, paramList);
+        final Map<String, Object> resultMap = this.getUserColumns(token);
 
         final FullUserProfile user = new FullUserProfile();
         user.setId((Long) resultMap.get("out_id"));
@@ -199,35 +207,6 @@ public class UserRepository {
         return user;
     }
 
-    public UserSettings getUserSettings(final long id) {
-        return this.jdbc.queryForObject("SELECT no_vacations, no_sick_days, user_role FROM end_user WHERE id=?",
-                new Object[]{id}, (ResultSet rs, int rowNum) -> {
-                    final UserSettings settings = new UserSettings();
-                    settings.setId(id);
-                    settings.setSickDayCount(rs.getInt("no_sick_day"));
-                    settings.setVacationCount(rs.getFloat("no_vacations"));
-                    settings.setRole(UserRole.getUserRole(rs.getString("user_role")));
-                    return settings;
-                });
-    }
-
-    public void decreaseVacationCount(final long id, final float value) {
-        this.jdbc.update("UPDATE end_user SET no_vacations = no_vacations - ? WHERE id = ?", value, id);
-    }
-
-    public void increaseTakenSickdays(final long id) {
-        this.jdbc.update("UPDATE end_user SET taken_sick_days = taken_sick_days + 1 WHERE id = ?", id);
-    }
-
-    public void updateNotification(final UserSettings settings) {
-        this.jdbc.update("UPDATE end_user SET alert = ? WHERE id = ?", settings.getNotification(), settings.getId());
-    }
-
-    public void updateUserSettings(final UserSettings settings) {
-        this.jdbc.update("UPDATE end_user SET no_vacations=?, no_sick_days=?, user_role=? WHERE id = ?",
-                settings.getVacationCount(), settings.getSickDayCount(), settings.getRole().name(), settings.getId());
-    }
-
     public DefaultSettings getLastDefaultSettings() {
         return this.jdbc.queryForObject("SELECT * FROM default_settings ORDER BY id DESC LIMIT 1", (ResultSet rs, int rowNum) -> {
             final DefaultSettings settings = new DefaultSettings();
@@ -237,7 +216,38 @@ public class UserRepository {
         });
     }
 
-    public void insertSettings(final DefaultSettings settings) {
+    //---------------------------------- DOMAIN -----------------------------------
+
+    public User getUser(final long id) {
+        final Map<String, Object> resultMap = this.getUserColumns(id);
+        return new User(
+                id,
+                (String) resultMap.get("out_first_name"),
+                (String) resultMap.get("out_last_name"),
+                ((Double) resultMap.get("out_no_vacations")).floatValue(),
+                (Integer) resultMap.get("out_no_sick_days"),
+                (Integer) resultMap.get("out_taken_sick_days"),
+                ((Timestamp) resultMap.get("out_alert")).toLocalDateTime(),
+                (String) resultMap.get("out_token"),
+                (String) resultMap.get("out_email"),
+                (String) resultMap.get("out_photo"),
+                ((Timestamp) resultMap.get("out_creation_date")).toLocalDateTime(),
+                UserRole.getUserRole((String) resultMap.get("out_role")),
+                Status.getStatus((String) resultMap.get("out_status"))
+        );
+    }
+
+    public void updateUser(final cz.zcu.yamanager.domain.User user) {
+        this.jdbc.update("UPDATE end_user SET first_name = ?, last_name = ?, no_vacations = ?, no_sick_days = ?, taken_sick_days = ?, alert = ?, token = ?, email = ?, photo = ?, user_role = ?, status = ? WHERE id = ?",
+                user.getFirstName(), user.getLastName(), user.getVacationCount(), user.getTotalSickDayCount(), user.getTakenSickDayCount(), user.getNotification(), user.getToken(), user.getEmail(), user.getPhoto(), user.getRole().name(), user.getStatus().name(), user.getId());
+    }
+
+    public void insertUser(final User user) {
+        this.jdbc.update("INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES (?,?,?,?,?,?,?,?,?,?,?)",
+                user.getFirstName(), user.getLastName(), user.getVacationCount(), user.getTotalSickDayCount(), user.getTakenSickDayCount(), user.getNotification(), user.getToken(), user.getEmail(), user.getPhoto(), user.getRole().name(), user.getStatus().name());
+    }
+
+    public void insertSettings(final cz.zcu.yamanager.domain.DefaultSettings settings) {
         this.jdbc.update("INSERT INTO default_settings (no_sick_days, alert) VALUES (?, ?)", settings.getSickDayCount(), settings.getNotification());
     }
 }
diff --git a/server/src/main/java/cz/zcu/yamanager/repository/VacationRepository.java b/server/src/main/java/cz/zcu/yamanager/repository/VacationRepository.java
index 6990698..9a2f537 100644
--- a/server/src/main/java/cz/zcu/yamanager/repository/VacationRepository.java
+++ b/server/src/main/java/cz/zcu/yamanager/repository/VacationRepository.java
@@ -140,12 +140,28 @@ public class VacationRepository {
                 });
     }
 
-    public void insertVacationDay(final Long userId, final VacationDay day) {
+    public cz.zcu.yamanager.domain.VacationDay getVacationDay(final long id) {
+        return this.jdbc.queryForObject("SELECT id, vacation_date, time_from, time_to, creation_date, status, vacation_type" +
+                        "FROM vacation_day " +
+                        "WHERE id = ?", new Object[]{id},
+                (ResultSet rs, int rowNum) ->
+                    new cz.zcu.yamanager.domain.VacationDay(
+                            rs.getLong("id"),
+                            rs.getDate("vacation_date").toLocalDate(),
+                            rs.getTime("time_from").toLocalTime(),
+                            rs.getTime("time_to").toLocalTime(),
+                            rs.getTimestamp("creation_date").toLocalDateTime(),
+                            Status.getStatus(rs.getString("status")),
+                            VacationType.getVacationType(rs.getString("v.vacation_type")))
+                );
+    }
+
+    public void insertVacationDay(final Long userId, final cz.zcu.yamanager.domain.VacationDay day) {
         this.jdbc.update("INSERT INTO vacation_day (vacation_date, time_from, time_to, status, vacation_type, user_id) VALUES (?,?,?,?,?,?)",
                 day.getDate(), day.getFrom(), day.getTo(), day.getStatus().name(), day.getType().name(), userId);
     }
 
-    public void updateVacationDay(final VacationDay item) {
+    public void updateVacationDay(final cz.zcu.yamanager.domain.VacationDay item) {
         this.jdbc.update("UPDATE vacation_day SET vacation_date=?, time_from=?, time_to=?, status=?, vacation_type=? WHERE id=?",
                 item.getDate(), item.getFrom(), item.getTo(), item.getStatus().name(), item.getType().name(), item.getId());
     }
diff --git a/server/src/main/java/cz/zcu/yamanager/ws/rest/ApiController.java b/server/src/main/java/cz/zcu/yamanager/ws/rest/ApiController.java
index 738f421..d9eb0b4 100644
--- a/server/src/main/java/cz/zcu/yamanager/ws/rest/ApiController.java
+++ b/server/src/main/java/cz/zcu/yamanager/ws/rest/ApiController.java
@@ -12,6 +12,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataAccessException;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
@@ -62,9 +63,12 @@ public class ApiController {
         } catch (RESTFullException e) {
             log.error(e.getMessage());
             return sendError(400, e.getLocalizedMessage(), language);
+        } catch (DataAccessException e) {
+            log.error(e.getMessage());
+            return sendError(500, "database.error", language);
         } catch (Exception e) {
             log.error(e.getMessage());
-            return sendError(401, "rest.exception.generic", language);
+            return sendError(401, e.getMessage(), language);
         }
     }
 
diff --git a/server/src/main/resources/Message_cs.properties b/server/src/main/resources/Message_cs.properties
index 62ee4ee..b3b0e74 100644
--- a/server/src/main/resources/Message_cs.properties
+++ b/server/src/main/resources/Message_cs.properties
@@ -1,7 +1,20 @@
 hello=Ahoj sv\u011Bte
 rest.exception.generic=N\u011Bco se stalo :(
-sick.day.count.error = Po\u010Det sick days nesm\u00ED b\u00FDt z\u00E1porn\u00FD!
-vacation.count.error = Po\u010Det p\u0159es\u010Das\u016F nesm\u00ED b\u00FDt z\u00E1porn\u00FD!
-name.length.error = D\u00E9lka jm\u00E9na nesm\u00ED p\u0159ekro\u010Dit 45 znak\u016F!
-email.length.error = D\u00E9lka emailu nesm\u00ED p\u0159ekro\u010Dit 100 znak\u016F!
-time.order.error = Dovolen\u00E1 nesm\u00ED za\u010D\u00EDnat pozd\u011Bji nebo ve stejn\u00FD \u010Das jako kon\u010D\u00ED!
\ No newline at end of file
+negative.sick.day.error = Po\u010Det sick days nesm\u00ED b\u00FDt z\u00E1porn\u00FD.
+negative.vacation.error = Po\u010Det p\u0159es\u010Das\u016F nesm\u00ED b\u00FDt z\u00E1porn\u00FD.
+available.vacation.error = Nen\u00ED mo\u017En\u00E9 vybrat p\u0159es\u010Das. Nem\u00E1te dostate\u010Dn\u00FD po\u010Det nad\u011Blan\u00FDch hodin.
+available.sick.day.error = Nen\u00ED mo\u017En\u00E9 vybrat sick day, ji\u017E V\u00E1m \u017E\u00E1dn\u00E9 nezb\u00FDvaj\u00ED.
+name.length.error = D\u00E9lka jm\u00E9na nesm\u00ED p\u0159ekro\u010Dit 45 znak\u016F.
+email.length.error = D\u00E9lka emailu nesm\u00ED p\u0159ekro\u010Dit 100 znak\u016F.
+time.sick.day.error = Sick day nesm\u00ED m\u00EDt nastaven \u010Das za\u010D\u00E1tku nebo konce.
+time.vacation.error = Dovolen\u00E1 mus\u00ED obsahovat \u010Das za\u010D\u00E1tku a konce.
+time.order.error = Dovolen\u00E1 nesm\u00ED za\u010D\u00EDnat pozd\u011Bji nebo ve stejn\u00FD \u010Das jako kon\u010D\u00ED.
+taken.sick.day.count.error = Nen\u00ED dovoleno vybrat v\u00EDce sick days ne\u017E je p\u0159id\u011Bleno.
+date.null.error = Datum mus\u00ED b\u00FDt zad\u00E1n.
+status.null.error = Status mus\u00ED b\u00FDt zad\u00E1n.
+type.null.error = Typ mus\u00ED b\u00FDt zad\u00E1n.
+sick.day.null.error = Po\u010Det sick days mus\u00ED b\u00FDt zad\u00E1n.
+notification.null.error = Datum upozorn\u011Bn\u00ED mus\u00ED b\u00FDt zad\u00E1n.
+vacation.null.error = Po\u010Det hodin dovolen\u00E9 mus\u00ED b\u00FDt zad\u00E1n.
+role.null.error = Role mus\u00ED b\u00FDt zad\u00E1n.
+database.error = Vyskytl se probl\u00E9m s datab\u00E1z\u00ED.
\ No newline at end of file
diff --git a/server/src/main/resources/Message_en.properties b/server/src/main/resources/Message_en.properties
index ac85c5a..361daf8 100644
--- a/server/src/main/resources/Message_en.properties
+++ b/server/src/main/resources/Message_en.properties
@@ -1,7 +1,20 @@
 hello=Hello world
 rest.exception.generic=Something happened :(
-sick.day.count.error = The number of sick days must not be negative!
-vacation.count.error = The number of hours of an overtime must not be negative!
-name.length.error = The length of a name must not exceed 45!
-email.length.error = The length of an email address must not exceed 100!
-time.order.error = The overtime must not start after or at the same time it ends!
+negative.sick.day.error = The number of sick days mustn't be negative.
+negative.vacation.error = The number of a remaining overtime mustn't be negative.
+available.vacation.error = You cannot take a vacation, not enough remaining hours.
+available.sick.day.error = You cannot take a sick day. You don't have any available sick days.
+name.length.error = The length of a name mustn't exceed 45.
+email.length.error = The length of an email address mustn't exceed 100.
+time.sick.day.error = A sick day mustn't have a starting or an ending time.
+time.vacation.error = A vacation has to have a starting and an ending time.
+time.order.error = The overtime mustn't start after or at the same time it ends.
+taken.sick.day.count.error = Not enough available sick days.
+date.null.error = The date has to be filled in.
+status.null.error = The status has to be filled in.
+type.null.error = The type has to be filled in.
+sick.day.null.error = The number of sick days has to be filled in.
+notification.null.error = The date of a notification has to be filled in.
+vacation.null.error = The number of overtime hours has to be filled in.
+role.null.error = The role has to be filled in.
+database.error = There was a problem with the database.
\ No newline at end of file
diff --git a/server/src/test/java/cz/zcu/yamanager/domain/DefaultSettingsTest.java b/server/src/test/java/cz/zcu/yamanager/domain/DefaultSettingsTest.java
index f42187a..a5bdff9 100644
--- a/server/src/test/java/cz/zcu/yamanager/domain/DefaultSettingsTest.java
+++ b/server/src/test/java/cz/zcu/yamanager/domain/DefaultSettingsTest.java
@@ -61,6 +61,14 @@ class DefaultSettingsTest {
         assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setSickDayCount(-10));
     }
 
+    /**
+     * Tests the method {@code setSickDayCount} with null value.
+     */
+    @Test
+    void testSetSickDaysCountObjectNull() {
+        assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setSickDayCount(null));
+    }
+
     /**
      * Tests the method {@code toString}.
      */
diff --git a/server/src/test/java/cz/zcu/yamanager/domain/UserTest.java b/server/src/test/java/cz/zcu/yamanager/domain/UserTest.java
index 1ef6bbc..4e362b6 100644
--- a/server/src/test/java/cz/zcu/yamanager/domain/UserTest.java
+++ b/server/src/test/java/cz/zcu/yamanager/domain/UserTest.java
@@ -6,6 +6,7 @@ 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.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -86,7 +87,7 @@ class UserTest {
      */
     @Test
     void testSetVacationCount() {
-        this.user.setVacationCount(10);
+        this.user.setVacationCount(10f);
         assertEquals(10, this.user.getVacationCount());
     }
 
@@ -95,7 +96,7 @@ class UserTest {
      */
     @Test
     void testSetVacationCountZero() {
-        this.user.setVacationCount(0);
+        this.user.setVacationCount(0f);
         assertEquals(0, this.user.getVacationCount());
     }
 
@@ -104,7 +105,7 @@ class UserTest {
      */
     @Test
     void testSetVacationCountNegativeOne() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(-1));
+        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(-1f));
     }
 
     /**
@@ -112,55 +113,15 @@ class UserTest {
      */
     @Test
     void testSetVacationCountNegative() {
-        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(-10));
+        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(-10f));
     }
 
     /**
-     * Tests the method {@code decreaseVacationCount} with common values where no problem should occur.
+     * Tests the method {@code setVacationCount} with null value.
      */
     @Test
-    void testDecreaseVacationCount() {
-        this.user.setVacationCount(10);
-        this.user.decreaseVacationCount(4);
-        assertEquals(6, this.user.getVacationCount());
-    }
-
-    /**
-     * Tests the method {@code decreaseVacationCount} with result equals to zero.
-     */
-    @Test
-    void testDecreaseVacationCountZeroResult() {
-        this.user.setVacationCount(10);
-        this.user.decreaseVacationCount(10);
-        assertEquals(0, this.user.getVacationCount());
-    }
-
-    /**
-     * Tests the method {@code decreaseVacationCount} with result equals to -1.
-     */
-    @Test
-    void testDecreaseVacationCountNegativeOneResult() {
-        this.user.setVacationCount(10);
-        assertThrows(IllegalArgumentException.class, () -> this.user.decreaseVacationCount(11));
-    }
-
-    /**
-     * Tests the method {@code decreaseVacationCount} with result equals to negative number.
-     */
-    @Test
-    void testDecreaseVacationCountNegativeResult() {
-        this.user.setVacationCount(10);
-        assertThrows(IllegalArgumentException.class, () -> this.user.decreaseVacationCount(50));
-    }
-
-    /**
-     * Tests the method {@code decreaseVacationCount} with negative input.
-     */
-    @Test
-    void testDecreaseVacationCountNegativeInput() {
-        this.user.setVacationCount(10);
-        this.user.decreaseVacationCount(-10);
-        assertEquals(20, this.user.getVacationCount());
+    void testSetVacationCountObjectNull() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setVacationCount(null));
     }
 
     /**
@@ -197,11 +158,20 @@ class UserTest {
         assertThrows(IllegalArgumentException.class, () -> this.user.setTotalSickDayCount(-10));
     }
 
+    /**
+     * Tests the method {@code setTotalSickDayCount} with null value.
+     */
+    @Test
+    void testSetTotalSickDayCountObjectNull() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setTotalSickDayCount(null));
+    }
+
     /**
      * Tests the method {@code setTakenSickDayCount} with common values where no problem should occur.
      */
     @Test
     void testSetTakenSickDayCount() {
+        this.user.setTotalSickDayCount(50);
         this.user.setTakenSickDayCount(10);
         assertEquals(10, this.user.getTakenSickDayCount());
     }
@@ -211,6 +181,7 @@ class UserTest {
      */
     @Test
     void testSetTakenSickDayCountZero() {
+        this.user.setTotalSickDayCount(50);
         this.user.setTakenSickDayCount(0);
         assertEquals(0, this.user.getTakenSickDayCount());
     }
@@ -220,6 +191,7 @@ class UserTest {
      */
     @Test
     void testSetTakenSickDayCountNegativeOne() {
+        this.user.setTotalSickDayCount(10);
         assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(-1));
     }
 
@@ -228,9 +200,54 @@ class UserTest {
      */
     @Test
     void testSetTakenSickDayCountNegative() {
+        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 testSetTakenSickDayCountOver() {
+        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 testSetTakenSickDayCountSame() {
+        this.user.setTotalSickDayCount(10);
+        this.user.setTakenSickDayCount(10);
+        assertEquals(10, this.user.getTakenSickDayCount());
+    }
+
+    /**
+     * Tests the method {@code setTakenSickDayCount} with null value.
+     */
+    @Test
+    void testSetTakenSickDayCountObjectNull() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setTakenSickDayCount(null));
+    }
+
+    /**
+     * Tests the method {@code setNotification} with common values where no problem should occur.
+     */
+    @Test
+    void testSetNotification() {
+        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 testSetNotificationNull() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setNotification(null));
+    }
+
     /**
      * Tests the method {@code setEmail} with common values where no problem should occur.
      */
@@ -257,12 +274,114 @@ class UserTest {
         assertThrows(IllegalArgumentException.class, () -> this.user.setEmail("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
     }
 
+    /**
+     * Tests the method {@code setRole} with common values where no problem should occur.
+     */
+    @Test
+    void testSetRole() {
+        this.user.setRole(UserRole.EMPLOYER);
+        assertEquals(UserRole.EMPLOYER, this.user.getRole());
+    }
+
+    /**
+     * Tests the method {@code setRole} with null value.
+     */
+    @Test
+    void testSetRoleNull() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setRole(null));
+    }
+
+    /**
+     * Tests the method {@code setStatus} with common values where no problem should occur.
+     */
+    @Test
+    void testSetStatus() {
+        this.user.setStatus(Status.ACCEPTED);
+        assertEquals(Status.ACCEPTED, this.user.getStatus());
+    }
+
+    /**
+     * Tests the method {@code setStatus} with null value.
+     */
+    @Test
+    void testSetStatusNull() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.setStatus(null));
+    }
+
+    /**
+     * Tests the method {@code takeVacation} with common values where no problem should occur.
+     */
+    @Test
+    void testTakeVacation() {
+        this.user.setVacationCount(10f);
+        this.user.takeVacation(LocalTime.of(15,0), LocalTime.of(20, 0));
+        assertEquals(5, this.user.getVacationCount());
+    }
+
+    /**
+     * Tests the method {@code takeVacation} when there is not enough vacations.
+     */
+    @Test
+    void testTakeVacationException() {
+        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 testTakeVacationOrder() {
+        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 testTakeVacationNullFrom() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(null, LocalTime.of(15,0)));
+    }
+
+    /**
+     * Tests the method {@code takeVacation} with to argument null.
+     */
+    @Test
+    void testTakeVacationNullTo() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(LocalTime.of(15,0), null));
+    }
+
+    /**
+     * Tests the method {@code takeVacation } with both arguments null.
+     */
+    @Test
+    void testTakeVacationNullBoth() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeVacation(null, null));
+    }
+
+    /**
+     * Tests the method {@code takeVacation} with common values where no problem should occur.
+     */
+    @Test
+    void testTakeSickDay() {
+        this.user.setTotalSickDayCount(5);
+        this.user.takeSickDay();
+        assertEquals(1, this.user.getTakenSickDayCount());
+    }
+
+    /**
+     * Tests the method {@code takeVacation} when there is not enough available sick days.
+     */
+    @Test
+    void testTakeSickDayException() {
+        assertThrows(IllegalArgumentException.class, () -> this.user.takeSickDay());
+    }
+
     /**
      * Tests the method {@code toString}.
      */
     @Test
     void testToString() {
-        User user = new User(5, "Jan", "Nov\u00E1k", 0, 10, 5, LocalDateTime.of(2008,10,30,20,0), "tokenContent", "novak@email.com", "url", LocalDateTime.of(2010,7,31,12,5), UserRole.EMPLOYER, Status.ACCEPTED);
+        User user = new User(5, "Jan", "Nov\u00E1k",0f, 10, 5, LocalDateTime.of(2008,10,30,20,0), "tokenContent", "novak@email.com", "url", LocalDateTime.of(2010,7,31,12,5), UserRole.EMPLOYER, 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());
     }
 }
diff --git a/server/src/test/java/cz/zcu/yamanager/domain/VacationDayTest.java b/server/src/test/java/cz/zcu/yamanager/domain/VacationDayTest.java
index e636e25..5fc2d8e 100644
--- a/server/src/test/java/cz/zcu/yamanager/domain/VacationDayTest.java
+++ b/server/src/test/java/cz/zcu/yamanager/domain/VacationDayTest.java
@@ -1,7 +1,6 @@
 package cz.zcu.yamanager.domain;
 
 import cz.zcu.yamanager.dto.Status;
-import cz.zcu.yamanager.dto.VacationType;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -214,6 +213,6 @@ class VacationDayTest {
     @Test
     void testToStringSickDay() {
         VacationDay vacationDay = new VacationDay(5, LocalDate.of(2010,1,9), LocalDateTime.of(2008,10,30,20,0), Status.ACCEPTED);
-        assertEquals("VacationDay{id=5, date=2010-01-09, from=null, to=null, creationDate=2008-10-30T20:00, status=ACCEPTED, type=SICKDAY}", vacationDay.toString());
+        assertEquals("VacationDay{id=5, date=2010-01-09, from=null, to=null, creationDate=2008-10-30T20:00, status=ACCEPTED, type=SICK_DAY}", vacationDay.toString());
     }
 }
