commit e3637ab0a135540b6028c2edb29063b901f8e47d
Author: Lukas Cerny <luc.cerny@gmail.com>
Date:   Thu Jun 6 18:51:56 2019 +0200

    Cannot take a vacation in past, refactor VacationDay to Vacation in domain package

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 f5c9d36..487804f 100644
--- a/server/src/main/java/cz/zcu/yamanager/business/ApiManager.java
+++ b/server/src/main/java/cz/zcu/yamanager/business/ApiManager.java
@@ -1,6 +1,7 @@
 package cz.zcu.yamanager.business;
 
 import cz.zcu.yamanager.domain.User;
+import cz.zcu.yamanager.domain.Vacation;
 import cz.zcu.yamanager.dto.*;
 import cz.zcu.yamanager.repository.RequestRepository;
 import cz.zcu.yamanager.repository.UserRepository;
@@ -134,11 +135,16 @@ public class ApiManager implements Manager {
 
     @Override
     public void createVacation(Long userId, VacationDay vacationDay) throws RESTFullException {
+
+        if (vacationDay.getDate().isBefore(LocalDate.now())) {
+            throw new RESTFullException("Vacation cannot be token in past.", "vacation.past.error");
+        }
+
         try {
             User user = userRepository.getUser(userId);
             vacationDay.setStatus(user.getRole() == UserRole.EMPLOYER ? Status.ACCEPTED : Status.PENDING);
 
-            cz.zcu.yamanager.domain.VacationDay vacation = new cz.zcu.yamanager.domain.VacationDay();
+            Vacation vacation = new Vacation();
             vacation.setDate(vacationDay.getDate());
             vacation.setFrom(vacationDay.getFrom());
             vacation.setTo(vacationDay.getTo());
@@ -221,7 +227,7 @@ public class ApiManager implements Manager {
     @Override
     public void changeVacation(Long userId, VacationDay vacationDay) throws RESTFullException {
         try {
-            Optional<cz.zcu.yamanager.domain.VacationDay> vacation = vacationRepository.getVacationDay(vacationDay.getId());
+            Optional<Vacation> vacation = vacationRepository.getVacationDay(vacationDay.getId());
             if (vacation.isPresent()) {
                 vacation.get().setDate(vacationDay.getDate());
                 vacation.get().setStatus(vacationDay.getStatus());
@@ -241,20 +247,20 @@ public class ApiManager implements Manager {
             switch (type) {
                 case VACATION: {
 
-                    Optional<cz.zcu.yamanager.domain.VacationDay> vacationDayOpt = vacationRepository.getVacationDay(request.getId());
+                    Optional<Vacation> vacationDayOpt = vacationRepository.getVacationDay(request.getId());
 
                     if (!vacationDayOpt.isPresent()) {
                         throw new RESTFullException("", "");
                     }
 
-                    cz.zcu.yamanager.domain.VacationDay vacationDay = vacationDayOpt.get();
+                    Vacation vacation = vacationDayOpt.get();
 
                     if (request.getStatus().equals(Status.REJECTED)) {
-                        User user = userRepository.getUser(vacationDay.getUserId());
+                        User user = userRepository.getUser(vacation.getUserId());
 
-                        switch (vacationDay.getType()) {
+                        switch (vacation.getType()) {
                             case VACATION: {
-                                user.addVacationCount(vacationDay.getFrom(), vacationDay.getTo());
+                                user.addVacationCount(vacation.getFrom(), vacation.getTo());
                                 userRepository.updateUserTakenVacation(user);
                             } break;
                             case SICK_DAY: {
@@ -264,7 +270,7 @@ public class ApiManager implements Manager {
                         }
                     }
 
-                    requestRepository.updateVacationRequest(vacationDay.getId(), request.getStatus());
+                    requestRepository.updateVacationRequest(vacation.getId(), request.getStatus());
 
                 } break;
                 case AUTHORIZATION: {
@@ -283,13 +289,13 @@ public class ApiManager implements Manager {
     public void deleteVacation(Long userId, Long vacationId) throws RESTFullException {
         try {
             User user = userRepository.getUser(userId);
-            Optional<cz.zcu.yamanager.domain.VacationDay> vacation = vacationRepository.getVacationDay(vacationId);
+            Optional<Vacation> vacation = vacationRepository.getVacationDay(vacationId);
 
             if (!vacation.isPresent()) {
                 throw new RESTFullException("", "");
             }
 
-            cz.zcu.yamanager.domain.VacationDay vacationDay = vacation.get();
+            Vacation vacationDay = vacation.get();
 
             if (vacationDay.getDate().isAfter(LocalDate.now())) {
                 if (!vacationDay.getStatus().equals(Status.REJECTED)) {
diff --git a/server/src/main/java/cz/zcu/yamanager/domain/Vacation.java b/server/src/main/java/cz/zcu/yamanager/domain/Vacation.java
new file mode 100644
index 0000000..ea37fdc
--- /dev/null
+++ b/server/src/main/java/cz/zcu/yamanager/domain/Vacation.java
@@ -0,0 +1,301 @@
+package cz.zcu.yamanager.domain;
+
+import cz.zcu.yamanager.dto.Status;
+import cz.zcu.yamanager.dto.VacationType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+
+/**
+ * The domain class {@code Vacation} represents a single record in the 'vacation_day' table of a database.
+ * Class holds informations of an overtime or a sick day taken by a user.
+ */
+public class Vacation {
+    /**
+     * The logger.
+     */
+    private static final Logger log = LoggerFactory.getLogger(Vacation.class);
+
+    /**
+     * The ID of this vacation.
+     */
+    private Long id;
+
+    /**
+     * The date of this vacation.
+     */
+    private LocalDate date;
+
+    /**
+     * The starting time of this vacation.
+     */
+    private LocalTime from;
+
+    /**
+     * The ending time of this vacation.
+     */
+    private LocalTime to;
+
+    /**
+     * The date and time of a creation of this vacation.
+     */
+    private LocalDateTime creationDate;
+
+    /**
+     * The approval status of this vacation.
+     */
+    private Status status;
+
+    /**
+     * The type of this vacation.
+     */
+    private VacationType type;
+
+    private Long userId;
+
+    /**
+     * Returns the ID of this vacation.
+     *
+     * @return the ID of this vacation
+     */
+    public long getId() {
+        return this.id;
+    }
+
+    /**
+     * Replaces the ID of this vacation with the given one.
+     *
+     * @param id the given ID
+     */
+    public void setId(final Long id) {
+        Vacation.log.debug("Setting a new id: {}", id);
+
+        this.id = id;
+    }
+
+    /**
+     * Returns the date of this vacation.
+     *
+     * @return the date of this vacation
+     */
+    public LocalDate getDate() {
+        return this.date;
+    }
+
+    /**
+     * 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) throws IllegalArgumentException {
+        Vacation.log.debug("Settings a new value of a date: {}", date);
+
+        if (date == null) {
+            Vacation.log.warn("The given date must not be null.");
+            throw new IllegalArgumentException("date.null.error");
+        }
+
+        this.date = date;
+    }
+
+    /**
+     * Returns the starting time of this vacation.
+     *
+     * @return the starting time of this vacation
+     */
+    public LocalTime getFrom() {
+        return this.from;
+    }
+
+    /**
+     * Replaces the starting time of this vacation with the given time.
+     * If the given time is later or equals the ending time of this vacation the method throws an exception.
+     *
+     * @param from the new starting time
+     * @throws IllegalArgumentException when the given time is later or equals the ending time of this vacation
+     */
+    public void setFrom(final LocalTime from) throws IllegalArgumentException {
+        Vacation.log.debug("Settings a new value of the starting time of this vacation: {}", from);
+
+        if (from != null && this.type == VacationType.SICK_DAY) {
+            Vacation.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) {
+            Vacation.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) {
+            Vacation.log.warn("A vacation must not start after it ends. from={}, to={}", from, this.to);
+            throw new IllegalArgumentException("time.order.error");
+        }
+
+        this.from = from;
+    }
+
+    /**
+     * Returns the ending time of this vacation.
+     *
+     * @return the ending time of this vacation
+     */
+    public LocalTime getTo() {
+        return this.to;
+    }
+
+    /**
+     * Replaces the ending time of this vacation with the provided time.
+     * If the given time is earlier or equals the starting time of this vacation the method throws an exception.
+     *
+     * @param to the new ending time
+     * @throws IllegalArgumentException when the given time is earlier or equals the starting time of this vacation
+     */
+    public void setTo(final LocalTime to) throws IllegalArgumentException {
+        Vacation.log.debug("Settings a new value of the ending time of this vacation: {}", to);
+
+        if (to != null && this.type == VacationType.SICK_DAY) {
+            Vacation.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) {
+            Vacation.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) {
+            Vacation.log.warn("A vacation must not end after it starts. from={}, to={}", this.from, to);
+            throw new IllegalArgumentException("time.order.error");
+        }
+
+        this.to = to;
+    }
+
+    /**
+     * Replaces the starting and ending time of this vacation with the provided values.
+     * If the starting time is later or equals the ending time the method throws an exception.
+     *
+     * @param from the new starting time
+     * @param to   the new ending time
+     * @throws IllegalArgumentException when the ending time is earlier or equals the starting time
+     */
+    public void setTime(final LocalTime from, final LocalTime to) throws IllegalArgumentException {
+        Vacation.log.debug("Settings a new value of the starting {} and the ending {} time of this vacation.", from, to);
+
+        if ((from != null || to != null) && this.type == VacationType.SICK_DAY) {
+            Vacation.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) {
+            Vacation.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) {
+            Vacation.log.warn("A vacation must not start after it ends. from={}, to={}", from, to);
+            throw new IllegalArgumentException("time.order.error");
+        }
+
+        this.from = from;
+        this.to = to;
+    }
+
+    /**
+     * Returns the date and time of a creation of this vacation.
+     *
+     * @return the date and time of the creation of this vacation
+     */
+    public LocalDateTime getCreationDate() {
+        return this.creationDate;
+    }
+
+    /**
+     * Replaces the creation date of this vacation with the given date and time.
+     *
+     * @param creationDate the new creation date
+     */
+    public void setCreationDate(final LocalDateTime creationDate) {
+        Vacation.log.debug("Setting a new creation date of this vacation: {}", creationDate);
+
+        this.creationDate = creationDate;
+    }
+
+    /**
+     * Returns the approval status of this vacation.
+     *
+     * @return the approval status of this vacation
+     */
+    public Status getStatus() {
+        return this.status;
+    }
+
+    /**
+     * 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) throws IllegalArgumentException {
+        Vacation.log.debug("Setting a new approval status: {}", status);
+
+        if (status == null) {
+            Vacation.log.warn("The given status must not be null");
+            throw new IllegalArgumentException("status.null.error");
+        }
+
+        this.status = status;
+    }
+
+    /**
+     * Returns the type of this vacation.
+     *
+     * @return the type of this vacation
+     */
+    public VacationType getType() {
+        return this.type;
+    }
+
+    /**
+     * Replaces the type of this vacation with the handed type.
+     * 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) throws IllegalArgumentException {
+        Vacation.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) {
+            Vacation.log.warn("The given type of a vacation must not be null");
+            throw new IllegalArgumentException("type.null.error");
+        }
+
+        this.type = type;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    /**
+     * Gets a string representation of this vacation. The representation consists of its id, date, starting time, ending time, creation date, status and type.
+     *
+     * @return the string representation of this vacation
+     */
+    @Override
+    public String toString() {
+        return "Vacation{" +
+                "id=" + this.id +
+                ", date=" + this.date +
+                ", from=" + this.from +
+                ", to=" + this.to +
+                ", creationDate=" + this.creationDate +
+                ", status=" + this.status +
+                ", type=" + this.type +
+                '}';
+    }
+}
diff --git a/server/src/main/java/cz/zcu/yamanager/domain/VacationDay.java b/server/src/main/java/cz/zcu/yamanager/domain/VacationDay.java
deleted file mode 100644
index f89275c..0000000
--- a/server/src/main/java/cz/zcu/yamanager/domain/VacationDay.java
+++ /dev/null
@@ -1,301 +0,0 @@
-package cz.zcu.yamanager.domain;
-
-import cz.zcu.yamanager.dto.Status;
-import cz.zcu.yamanager.dto.VacationType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-
-/**
- * The domain class {@code VacationDay} represents a single record in the 'vacation_day' table of a database.
- * Class holds informations of an overtime or a sick day taken by a user.
- */
-public class VacationDay {
-    /**
-     * The logger.
-     */
-    private static final Logger log = LoggerFactory.getLogger(VacationDay.class);
-
-    /**
-     * The ID of this vacation.
-     */
-    private Long id;
-
-    /**
-     * The date of this vacation.
-     */
-    private LocalDate date;
-
-    /**
-     * The starting time of this vacation.
-     */
-    private LocalTime from;
-
-    /**
-     * The ending time of this vacation.
-     */
-    private LocalTime to;
-
-    /**
-     * The date and time of a creation of this vacation.
-     */
-    private LocalDateTime creationDate;
-
-    /**
-     * The approval status of this vacation.
-     */
-    private Status status;
-
-    /**
-     * The type of this vacation.
-     */
-    private VacationType type;
-
-    private Long userId;
-
-    /**
-     * Returns the ID of this vacation.
-     *
-     * @return the ID of this vacation
-     */
-    public long getId() {
-        return this.id;
-    }
-
-    /**
-     * Replaces the ID of this vacation with the given one.
-     *
-     * @param id the given ID
-     */
-    public void setId(final Long id) {
-        VacationDay.log.debug("Setting a new id: {}", id);
-
-        this.id = id;
-    }
-
-    /**
-     * Returns the date of this vacation.
-     *
-     * @return the date of this vacation
-     */
-    public LocalDate getDate() {
-        return this.date;
-    }
-
-    /**
-     * 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) 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;
-    }
-
-    /**
-     * Returns the starting time of this vacation.
-     *
-     * @return the starting time of this vacation
-     */
-    public LocalTime getFrom() {
-        return this.from;
-    }
-
-    /**
-     * Replaces the starting time of this vacation with the given time.
-     * If the given time is later or equals the ending time of this vacation the method throws an exception.
-     *
-     * @param from the new starting time
-     * @throws IllegalArgumentException when the given time is later or equals the ending time of this vacation
-     */
-    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.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");
-        }
-
-        this.from = from;
-    }
-
-    /**
-     * Returns the ending time of this vacation.
-     *
-     * @return the ending time of this vacation
-     */
-    public LocalTime getTo() {
-        return this.to;
-    }
-
-    /**
-     * Replaces the ending time of this vacation with the provided time.
-     * If the given time is earlier or equals the starting time of this vacation the method throws an exception.
-     *
-     * @param to the new ending time
-     * @throws IllegalArgumentException when the given time is earlier or equals the starting time of this vacation
-     */
-    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.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");
-        }
-
-        this.to = to;
-    }
-
-    /**
-     * Replaces the starting and ending time of this vacation with the provided values.
-     * If the starting time is later or equals the ending time the method throws an exception.
-     *
-     * @param from the new starting time
-     * @param to   the new ending time
-     * @throws IllegalArgumentException when the ending time is earlier or equals the starting time
-     */
-    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) && 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");
-        }
-
-        this.from = from;
-        this.to = to;
-    }
-
-    /**
-     * Returns the date and time of a creation of this vacation.
-     *
-     * @return the date and time of the creation of this vacation
-     */
-    public LocalDateTime getCreationDate() {
-        return this.creationDate;
-    }
-
-    /**
-     * Replaces the creation date of this vacation with the given date and time.
-     *
-     * @param creationDate the new creation date
-     */
-    public void setCreationDate(final LocalDateTime creationDate) {
-        VacationDay.log.debug("Setting a new creation date of this vacation: {}", creationDate);
-
-        this.creationDate = creationDate;
-    }
-
-    /**
-     * Returns the approval status of this vacation.
-     *
-     * @return the approval status of this vacation
-     */
-    public Status getStatus() {
-        return this.status;
-    }
-
-    /**
-     * 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) 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;
-    }
-
-    /**
-     * Returns the type of this vacation.
-     *
-     * @return the type of this vacation
-     */
-    public VacationType getType() {
-        return this.type;
-    }
-
-    /**
-     * Replaces the type of this vacation with the handed type.
-     * 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) 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;
-    }
-
-    public Long getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Long userId) {
-        this.userId = userId;
-    }
-
-    /**
-     * Gets a string representation of this vacation. The representation consists of its id, date, starting time, ending time, creation date, status and type.
-     *
-     * @return the string representation of this vacation
-     */
-    @Override
-    public String toString() {
-        return "VacationDay{" +
-                "id=" + this.id +
-                ", date=" + this.date +
-                ", from=" + this.from +
-                ", to=" + this.to +
-                ", creationDate=" + this.creationDate +
-                ", status=" + this.status +
-                ", type=" + this.type +
-                '}';
-    }
-}
diff --git a/server/src/main/java/cz/zcu/yamanager/dto/VacationDay.java b/server/src/main/java/cz/zcu/yamanager/dto/VacationDay.java
index 2e2503e..4f4d236 100644
--- a/server/src/main/java/cz/zcu/yamanager/dto/VacationDay.java
+++ b/server/src/main/java/cz/zcu/yamanager/dto/VacationDay.java
@@ -4,7 +4,7 @@ import java.time.LocalDate;
 import java.time.LocalTime;
 
 /**
- * The messenger class {@code VacationDay} holds informations of an overtime or a sick day taken by a user.
+ * The messenger class {@code Vacation} holds informations of an overtime or a sick day taken by a user.
  * This class is used in communication with a frontend.
  */
 public class VacationDay {
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 b6b3600..7623512 100644
--- a/server/src/main/java/cz/zcu/yamanager/repository/VacationRepository.java
+++ b/server/src/main/java/cz/zcu/yamanager/repository/VacationRepository.java
@@ -1,6 +1,7 @@
 package cz.zcu.yamanager.repository;
 
 import cz.zcu.yamanager.domain.User;
+import cz.zcu.yamanager.domain.Vacation;
 import cz.zcu.yamanager.dto.*;
 
 import org.slf4j.Logger;
@@ -23,15 +24,15 @@ import static java.util.Optional.ofNullable;
 @Repository
 public class VacationRepository {
     /**
-     * The mapper maps a row from a result of a query to an VacationDay.
+     * The mapper maps a row from a result of a query to an Vacation.
      */
     private class VacationDayMapper implements RowMapper<VacationDay> {
 
         /**
-         * Maps a row from a result of a query to an VacationDay.
+         * Maps a row from a result of a query to an Vacation.
          * @param resultSet the row from the result
          * @param i the index of the row
-         * @return the VacationDay object
+         * @return the Vacation object
          * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
          */
         @Override
@@ -116,13 +117,13 @@ public class VacationRepository {
                 new Object[]{userId, from, to, status.name()}, new VacationDayMapper());
     }
 
-    public Optional<cz.zcu.yamanager.domain.VacationDay> getVacationDay(final long id) {
+    public Optional<Vacation> getVacationDay(final long id) {
         return ofNullable(jdbc.queryForObject("SELECT id, vacation_date, time_from, time_to, creation_date, status, vacation_type, user_id " +
                         "FROM vacation_day WHERE id = ?", new Object[]{id},
                 (ResultSet rs, int rowNum) -> {
-                    cz.zcu.yamanager.domain.VacationDay vacationDay = new cz.zcu.yamanager.domain.VacationDay();
-                    vacationDay.setId(rs.getLong("id"));
-                    vacationDay.setDate(rs.getDate("vacation_date").toLocalDate());
+                    Vacation vacation = new Vacation();
+                    vacation.setId(rs.getLong("id"));
+                    vacation.setDate(rs.getDate("vacation_date").toLocalDate());
                     /*
                         When a result contains a sick day it doesn't have specified a start and end time because
                         it can be taken only as a whole day. In this case the v.time_from and v.time_to are null.
@@ -130,28 +131,28 @@ public class VacationRepository {
                     */
                     final Time timeFrom = rs.getTime("time_from");
                     if (timeFrom != null) {
-                        vacationDay.setFrom(timeFrom.toLocalTime());
+                        vacation.setFrom(timeFrom.toLocalTime());
                     }
 
                     final Time timeTo = rs.getTime("time_to");
                     if (timeTo != null) {
-                        vacationDay.setTo(timeTo.toLocalTime());
+                        vacation.setTo(timeTo.toLocalTime());
                     }
 
-                    vacationDay.setCreationDate(rs.getTimestamp("creation_date").toLocalDateTime());
-                    vacationDay.setStatus(getStatus(rs.getString("status")));
-                    vacationDay.setType(VacationType.getVacationType(rs.getString("vacation_type")));
-                    vacationDay.setUserId(rs.getLong("user_id"));
-                    return vacationDay;
+                    vacation.setCreationDate(rs.getTimestamp("creation_date").toLocalDateTime());
+                    vacation.setStatus(getStatus(rs.getString("status")));
+                    vacation.setType(VacationType.getVacationType(rs.getString("vacation_type")));
+                    vacation.setUserId(rs.getLong("user_id"));
+                    return vacation;
                 }));
     }
 
-    public void insertVacationDay(final Long userId, final cz.zcu.yamanager.domain.VacationDay day) {
+    public void insertVacationDay(final Long userId, final Vacation day) {
         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 cz.zcu.yamanager.domain.VacationDay item) {
+    public void updateVacationDay(final Vacation item) {
         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/resources/Message_cs.properties b/server/src/main/resources/Message_cs.properties
index 1668fde..a5c6cfd 100644
--- a/server/src/main/resources/Message_cs.properties
+++ b/server/src/main/resources/Message_cs.properties
@@ -22,4 +22,5 @@ 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
+database.error = Vyskytl se probl\u00E9m s datab\u00E1z\u00ED.
+vacation.past.error = Nelze vybrat volno v minulosti.
\ 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 533645e..91f77a6 100644
--- a/server/src/main/resources/Message_en.properties
+++ b/server/src/main/resources/Message_en.properties
@@ -22,4 +22,5 @@ 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
+database.error = There was a problem with the database.
+vacation.past.error = You cannot take a vacation in past.
\ No newline at end of file
diff --git a/server/src/test/java/cz/zcu/yamanager/domain/VacationDayTest.java b/server/src/test/java/cz/zcu/yamanager/domain/VacationDayTest.java
deleted file mode 100644
index 9263379..0000000
--- a/server/src/test/java/cz/zcu/yamanager/domain/VacationDayTest.java
+++ /dev/null
@@ -1,553 +0,0 @@
-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;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-/**
- * This class tests methods of the {@code VacationDay} class.
- * @see VacationDay
- */
-class VacationDayTest {
-    /**
-     * The empty instance of the {@code VacationDay}.
-     */
-    private VacationDay vacationDay;
-
-    /**
-     * Prepares the instance of the {@code VacationDay}.
-     */
-    @BeforeEach
-    void setUp() {
-        this.vacationDay = new VacationDay();
-    }
-
-    /**
-     * Tests the method {@code setDate} with common values where no problem should occur.
-     */
-    @Test
-    void setDate_valid() {
-        LocalDate date = LocalDate.of(2000,10,12);
-        this.vacationDay.setDate(date);
-        assertEquals(date, this.vacationDay.getDate());
-    }
-
-    /**
-     * Tests the method {@code setDate} with null input value.
-     */
-    @Test
-    void setDate_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setDate(null));
-    }
-
-    /**
-     * Tests the method {@code setFrom} with a null input, null ending time and null vacation type.
-     */
-    @Test
-    void setFrom_nullFrom_nullTo_nullType_valid() {
-        this.vacationDay.setFrom(null);
-        assertNull(this.vacationDay.getFrom());
-    }
-
-    /**
-     * Tests the method {@code setFrom} with a null input, ending time and null vacation type.
-     */
-    @Test
-    void setFrom_nullFrom_to_nullType_valid() {
-        this.vacationDay.setTo(LocalTime.of(20, 0));
-        this.vacationDay.setFrom(null);
-        assertNull(this.vacationDay.getFrom());
-    }
-
-    /**
-     * Tests the method {@code setFrom} with an input, null ending time and null vacation type.
-     */
-    @Test
-    void setFrom_from_nullTo_nullType_valid() {
-        LocalTime from = LocalTime.of(10,0);
-        this.vacationDay.setFrom(from);
-        assertEquals(from, this.vacationDay.getFrom());
-    }
-
-    /**
-     * Tests the method {@code setFrom} with an input, ending time and null vacation type.
-     */
-    @Test
-    void setFrom_from_to_nullType_valid() {
-        LocalTime to = LocalTime.of(20, 0);
-        this.vacationDay.setTo(to);
-        LocalTime from = LocalTime.of(10,0);
-        this.vacationDay.setFrom(from);
-        assertEquals(from, this.vacationDay.getFrom());
-    }
-
-    /**
-     * Tests the method {@code setFrom} with same input and ending time and null vacation type.
-     */
-    @Test
-    void setFrom_from_to_nullType_same() {
-        LocalTime to = LocalTime.of(10, 0);
-        this.vacationDay.setTo(to);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setFrom(to));
-    }
-
-    /**
-     * Tests the method {@code setFrom} with same input and ending time and null vacation type.
-     */
-    @Test
-    void setFrom_from_to_nullType_wrongOrder() {
-        LocalTime to = LocalTime.of(10, 0);
-        this.vacationDay.setTo(to);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setFrom(LocalTime.of(20,0)));
-    }
-
-    /**
-     * Tests the method {@code setFrom} with a null input, null ending time and sick day vacation type.
-     */
-    @Test
-    void setFrom_nullFrom_nullTo_sickDay_valid() {
-        this.vacationDay.setType(VacationType.SICK_DAY);
-        this.vacationDay.setFrom(null);
-        assertNull(this.vacationDay.getFrom());
-    }
-
-    /**
-     * Tests the method {@code setFrom} with an input and sick day vacation type.
-     */
-    @Test
-    void setFrom_from_sickDay() {
-        this.vacationDay.setType(VacationType.SICK_DAY);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setFrom(LocalTime.of(20,0)));
-    }
-
-    /**
-     * Tests the method {@code setFrom} with a null input, null ending time and vacation vacation type.
-     */
-    @Test
-    void setFrom_nullFrom_vacation_valid() {
-        this.vacationDay.setFrom(null);
-        assertNull(this.vacationDay.getFrom());
-    }
-
-    /**
-     * Tests the method {@code setFrom} with an input, null ending time and vacation vacation type.
-     */
-    @Test
-    void setFrom_from_nullTo_vacation_valid() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime from = LocalTime.of(10,0);
-        this.vacationDay.setFrom(from);
-        assertEquals(from, this.vacationDay.getFrom());
-    }
-
-    /**
-     * Tests the method {@code setFrom} with an input, ending time and vacation vacation type.
-     */
-    @Test
-    void setFrom_from_to_vacation_valid() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime to = LocalTime.of(20, 0);
-        this.vacationDay.setTo(to);
-        LocalTime from = LocalTime.of(10,0);
-        this.vacationDay.setFrom(from);
-        assertEquals(from, this.vacationDay.getFrom());
-    }
-
-    /**
-     * Tests the method {@code setFrom} with same input and ending time and vacation vacation type.
-     */
-    @Test
-    void setFrom_from_to_vacation_same() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime to = LocalTime.of(10, 0);
-        this.vacationDay.setTo(to);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setFrom(LocalTime.of(10,0)));
-    }
-
-    /**
-     * Tests the method {@code setFrom} with same input and ending time and vacation vacation type.
-     */
-    @Test
-    void setFrom_from_to_vacation_wrongOrder() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime to = LocalTime.of(10, 0);
-        this.vacationDay.setTo(to);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setFrom(LocalTime.of(20,0)));
-    }
-
-    /**
-     * Tests the method {@code setTo} with a null input, null starting time and null vacation type.
-     */
-    @Test
-    void setTo_nullTo_nullFrom_nullType_valid() {
-        this.vacationDay.setTo(null);
-        assertNull(this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTo} with a null input, starting time and null vacation type.
-     */
-    @Test
-    void setTo_nullTo_from_nullType_valid() {
-        this.vacationDay.setFrom(LocalTime.of(20, 0));
-        this.vacationDay.setTo(null);
-        assertNull(this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTo} with an input, null starting time and null vacation type.
-     */
-    @Test
-    void setTo_to_nullFrom_nullType_valid() {
-        LocalTime to = LocalTime.of(10,0);
-        this.vacationDay.setTo(to);
-        assertEquals(to, this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTo} with an input, starting time and null vacation type.
-     */
-    @Test
-    void setTo_to_from_nullType_valid() {
-        LocalTime from = LocalTime.of(10, 0);
-        this.vacationDay.setFrom(from);
-        LocalTime to = LocalTime.of(20,0);
-        this.vacationDay.setTo(to);
-        assertEquals(to, this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTo} with same input and starting time and null vacation type.
-     */
-    @Test
-    void setTo_to_from_nullType_same() {
-        LocalTime from = LocalTime.of(10, 0);
-        this.vacationDay.setFrom(from);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTo(LocalTime.of(10,0)));
-    }
-
-    /**
-     * Tests the method {@code setTo} with same input and starting time and null vacation type.
-     */
-    @Test
-    void setTo_to_from_nullType_wrongOrder() {
-        LocalTime from = LocalTime.of(20, 0);
-        this.vacationDay.setFrom(from);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTo(LocalTime.of(10,0)));
-    }
-
-    /**
-     * Tests the method {@code setTo} with a null input, null starting time and sick day vacation type.
-     */
-    @Test
-    void setTo_nullTo_nullFrom_sickDay_valid() {
-        this.vacationDay.setType(VacationType.SICK_DAY);
-        this.vacationDay.setTo(null);
-        assertNull(this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTo} with an input and sick day vacation type.
-     */
-    @Test
-    void setTo_to_sickDay() {
-        this.vacationDay.setType(VacationType.SICK_DAY);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTo(LocalTime.of(20,0)));
-    }
-
-    /**
-     * Tests the method {@code setTo} with a null input, null starting time and vacation vacation type.
-     */
-    @Test
-    void setTo_nullTo_vacation_valid() {
-        this.vacationDay.setTo(null);
-        assertNull(this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTo} with an input, null starting time and vacation vacation type.
-     */
-    @Test
-    void setTo_to_nullFrom_vacation_valid() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime to = LocalTime.of(10,0);
-        this.vacationDay.setTo(to);
-        assertEquals(to, this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTo} with an input, starting time and vacation vacation type.
-     */
-    @Test
-    void setTo_to_from_vacation_valid() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime from = LocalTime.of(10, 0);
-        this.vacationDay.setFrom(from);
-        LocalTime to = LocalTime.of(20,0);
-        this.vacationDay.setTo(to);
-        assertEquals(to, this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTo} with same input and starting time and vacation vacation type.
-     */
-    @Test
-    void setTo_to_from_vacation_same() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime from = LocalTime.of(10, 0);
-        this.vacationDay.setFrom(from);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTo(from));
-    }
-
-    /**
-     * Tests the method {@code setTo} with same input and starting time and vacation vacation type.
-     */
-    @Test
-    void setTo_to_from_vacation_wrongOrder() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime from = LocalTime.of(20, 0);
-        this.vacationDay.setFrom(from);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTo(LocalTime.of(10,0)));
-    }
-
-    /**
-     * Tests the method {@code setTime} with common values where no problem should occur.
-     */
-    @Test
-    void setTime_nullType_valid() {
-        LocalTime from = LocalTime.of(10,0);
-        LocalTime to = LocalTime.of(20,0);
-        this.vacationDay.setTime(from, to);
-        assertEquals(from, this.vacationDay.getFrom());
-        assertEquals(to, this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTime} with the same times.
-     */
-    @Test
-    void setTime_nullType_same() {
-        LocalTime from = LocalTime.of(10,0);
-        LocalTime to = LocalTime.of(10,0);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(from, to));
-    }
-
-    /**
-     * Tests the method {@code setTime} with later start.
-     */
-    @Test
-    void setTime_nullType_wrongOrder() {
-        LocalTime from = LocalTime.of(20,0);
-        LocalTime to = LocalTime.of(10,0);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(from, to));
-    }
-
-    /**
-     * Tests the method {@code setTime} with null {@code from} input.
-     */
-    @Test
-    void setTime_nullFrom_nullType_valid() {
-        LocalTime to = LocalTime.of(10,0);
-        this.vacationDay.setTime(null, to);
-        assertNull(this.vacationDay.getFrom());
-        assertEquals(to, this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTime} with null {@code to} input.
-     */
-    @Test
-    void setTime_nullTo_nullType_valid() {
-        LocalTime from = LocalTime.of(20,0);
-        this.vacationDay.setTime(from, null);
-        assertNull(this.vacationDay.getTo());
-        assertEquals(from, this.vacationDay.getFrom());
-    }
-
-    /**
-     * Tests the method {@code setTime} with null input.
-     */
-    @Test
-    void setTime_nullFrom_nullTo_nullType_valid() {
-        this.vacationDay.setTime(null, null);
-        assertNull(this.vacationDay.getFrom());
-        assertNull(this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTime} with null input and sick day vacation type.
-     */
-    @Test
-    void setTime_nullFrom_nullTo_sickDay_valid() {
-        this.vacationDay.setType(VacationType.SICK_DAY);
-        this.vacationDay.setTime(null, null);
-        assertNull(this.vacationDay.getFrom());
-        assertNull(this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTime} with from, null to and sick day vacation type.
-     */
-    @Test
-    void setTime_from_nullTo_sickDay() {
-        this.vacationDay.setType(VacationType.SICK_DAY);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(LocalTime.of(10,0), null));
-    }
-
-    /**
-     * Tests the method {@code setTime} with null from, to and sick day vacation type.
-     */
-    @Test
-    void setTime_nullFrom_to_sickDay() {
-        this.vacationDay.setType(VacationType.SICK_DAY);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(null, LocalTime.of(10,0)));
-    }
-
-    /**
-     * Tests the method {@code setTime} with from, to and sick day vacation type.
-     */
-    @Test
-    void setTime_from_to_sickDay() {
-        this.vacationDay.setType(VacationType.SICK_DAY);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(LocalTime.of(10,0), LocalTime.of(20,0)));
-    }
-
-    /**
-     * Tests the method {@code setTime} with null input and vacation vacation type.
-     */
-    @Test
-    void setTime_nullFrom_nullTo_vacation() {
-        this.vacationDay.setType(VacationType.VACATION);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(null, null));
-    }
-
-    /**
-     * Tests the method {@code setTime} with from, null to and vacation vacation type.
-     */
-    @Test
-    void setTime_from_nullTo_vacation() {
-        this.vacationDay.setType(VacationType.VACATION);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(LocalTime.of(10,0), null));
-    }
-
-    /**
-     * Tests the method {@code setTime} with null from, to and vacation vacation type.
-     */
-    @Test
-    void setTime_nullFrom_to_vacation() {
-        this.vacationDay.setType(VacationType.VACATION);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(null, LocalTime.of(10,0)));
-    }
-
-    /**
-     * Tests the method {@code setTime} with from, to and vacation vacation type.
-     */
-    @Test
-    void setTime_from_to_vacation_valid() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime from = LocalTime.of(10,0);
-        LocalTime to = LocalTime.of(20,0);
-        this.vacationDay.setTime(from, to);
-        assertEquals(from, this.vacationDay.getFrom());
-        assertEquals(to, this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setTime} with same from and to and vacation vacation type.
-     */
-    @Test
-    void setTime_from_to_vacation_same() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime from = LocalTime.of(10,0);
-        LocalTime to = LocalTime.of(10,0);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(from, to));
-    }
-
-    /**
-     * Tests the method {@code setTime} with later from than to and vacation vacation type.
-     */
-    @Test
-    void setTime_from_to_vacation_wrongOrder() {
-        this.vacationDay.setType(VacationType.VACATION);
-        LocalTime from = LocalTime.of(20,0);
-        LocalTime to = LocalTime.of(10,0);
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setTime(from, to));
-    }
-
-    /**
-     * Tests the method {@code setStatus} with common values where no problem should occur.
-     */
-    @Test
-    void setStatus_valid() {
-        this.vacationDay.setStatus(Status.ACCEPTED);
-        assertEquals(Status.ACCEPTED, this.vacationDay.getStatus());
-    }
-
-    /**
-     * Tests the method {@code setStatus} with null value.
-     */
-    @Test
-    void setStatus_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setStatus(null));
-    }
-
-    /**
-     * Tests the method {@code setType} with with vacation input.
-     */
-    @Test
-    void setType_valid() {
-        this.vacationDay.setType(VacationType.VACATION);
-        assertEquals(VacationType.VACATION, this.vacationDay.getType());
-    }
-
-    /**
-     * Tests the method {@code setType} with sick day input.
-     */
-    @Test
-    void setType_sickDay_valid() {
-        this.vacationDay.setType(VacationType.SICK_DAY);
-        assertEquals(VacationType.SICK_DAY, this.vacationDay.getType());
-        assertNull(this.vacationDay.getFrom());
-        assertNull(this.vacationDay.getTo());
-    }
-
-    /**
-     * Tests the method {@code setType} with null value.
-     */
-    @Test
-    void setType_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.vacationDay.setType(null));
-    }
-
-    /**
-     * Tests the method {@code toString}.
-     */
-    @Test
-    void toString_valid() {
-        VacationDay vacationDay = new VacationDay();
-        vacationDay.setId(5L);
-        vacationDay.setDate(LocalDate.of(2010,1,9));
-        vacationDay.setFrom(LocalTime.of(12,15));
-        vacationDay.setTo(LocalTime.of(22,30));
-        vacationDay.setCreationDate(LocalDateTime.of(2008,10,30,20,0));
-        vacationDay.setStatus(Status.ACCEPTED);
-        vacationDay.setType(VacationType.VACATION);
-        assertEquals("VacationDay{id=5, date=2010-01-09, from=12:15, to=22:30, creationDate=2008-10-30T20:00, status=ACCEPTED, type=VACATION}", vacationDay.toString());
-    }
-
-    /**
-     * Tests the method {@code toString} for a sick day.
-     */
-    @Test
-    void toString_null() {
-        VacationDay vacationDay = new VacationDay();
-        assertEquals("VacationDay{id=null, date=null, from=null, to=null, creationDate=null, status=null, type=null}", vacationDay.toString());
-    }
-}
diff --git a/server/src/test/java/cz/zcu/yamanager/domain/VacationTest.java b/server/src/test/java/cz/zcu/yamanager/domain/VacationTest.java
new file mode 100644
index 0000000..25221c9
--- /dev/null
+++ b/server/src/test/java/cz/zcu/yamanager/domain/VacationTest.java
@@ -0,0 +1,553 @@
+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;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * This class tests methods of the {@code Vacation} class.
+ * @see Vacation
+ */
+class VacationTest {
+    /**
+     * The empty instance of the {@code Vacation}.
+     */
+    private Vacation vacation;
+
+    /**
+     * Prepares the instance of the {@code Vacation}.
+     */
+    @BeforeEach
+    void setUp() {
+        this.vacation = new Vacation();
+    }
+
+    /**
+     * Tests the method {@code setDate} with common values where no problem should occur.
+     */
+    @Test
+    void setDate_valid() {
+        LocalDate date = LocalDate.of(2000,10,12);
+        this.vacation.setDate(date);
+        assertEquals(date, this.vacation.getDate());
+    }
+
+    /**
+     * Tests the method {@code setDate} with null input value.
+     */
+    @Test
+    void setDate_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setDate(null));
+    }
+
+    /**
+     * Tests the method {@code setFrom} with a null input, null ending time and null vacation type.
+     */
+    @Test
+    void setFrom_nullFrom_nullTo_nullType_valid() {
+        this.vacation.setFrom(null);
+        assertNull(this.vacation.getFrom());
+    }
+
+    /**
+     * Tests the method {@code setFrom} with a null input, ending time and null vacation type.
+     */
+    @Test
+    void setFrom_nullFrom_to_nullType_valid() {
+        this.vacation.setTo(LocalTime.of(20, 0));
+        this.vacation.setFrom(null);
+        assertNull(this.vacation.getFrom());
+    }
+
+    /**
+     * Tests the method {@code setFrom} with an input, null ending time and null vacation type.
+     */
+    @Test
+    void setFrom_from_nullTo_nullType_valid() {
+        LocalTime from = LocalTime.of(10,0);
+        this.vacation.setFrom(from);
+        assertEquals(from, this.vacation.getFrom());
+    }
+
+    /**
+     * Tests the method {@code setFrom} with an input, ending time and null vacation type.
+     */
+    @Test
+    void setFrom_from_to_nullType_valid() {
+        LocalTime to = LocalTime.of(20, 0);
+        this.vacation.setTo(to);
+        LocalTime from = LocalTime.of(10,0);
+        this.vacation.setFrom(from);
+        assertEquals(from, this.vacation.getFrom());
+    }
+
+    /**
+     * Tests the method {@code setFrom} with same input and ending time and null vacation type.
+     */
+    @Test
+    void setFrom_from_to_nullType_same() {
+        LocalTime to = LocalTime.of(10, 0);
+        this.vacation.setTo(to);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setFrom(to));
+    }
+
+    /**
+     * Tests the method {@code setFrom} with same input and ending time and null vacation type.
+     */
+    @Test
+    void setFrom_from_to_nullType_wrongOrder() {
+        LocalTime to = LocalTime.of(10, 0);
+        this.vacation.setTo(to);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setFrom(LocalTime.of(20,0)));
+    }
+
+    /**
+     * Tests the method {@code setFrom} with a null input, null ending time and sick day vacation type.
+     */
+    @Test
+    void setFrom_nullFrom_nullTo_sickDay_valid() {
+        this.vacation.setType(VacationType.SICK_DAY);
+        this.vacation.setFrom(null);
+        assertNull(this.vacation.getFrom());
+    }
+
+    /**
+     * Tests the method {@code setFrom} with an input and sick day vacation type.
+     */
+    @Test
+    void setFrom_from_sickDay() {
+        this.vacation.setType(VacationType.SICK_DAY);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setFrom(LocalTime.of(20,0)));
+    }
+
+    /**
+     * Tests the method {@code setFrom} with a null input, null ending time and vacation vacation type.
+     */
+    @Test
+    void setFrom_nullFrom_vacation_valid() {
+        this.vacation.setFrom(null);
+        assertNull(this.vacation.getFrom());
+    }
+
+    /**
+     * Tests the method {@code setFrom} with an input, null ending time and vacation vacation type.
+     */
+    @Test
+    void setFrom_from_nullTo_vacation_valid() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime from = LocalTime.of(10,0);
+        this.vacation.setFrom(from);
+        assertEquals(from, this.vacation.getFrom());
+    }
+
+    /**
+     * Tests the method {@code setFrom} with an input, ending time and vacation vacation type.
+     */
+    @Test
+    void setFrom_from_to_vacation_valid() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime to = LocalTime.of(20, 0);
+        this.vacation.setTo(to);
+        LocalTime from = LocalTime.of(10,0);
+        this.vacation.setFrom(from);
+        assertEquals(from, this.vacation.getFrom());
+    }
+
+    /**
+     * Tests the method {@code setFrom} with same input and ending time and vacation vacation type.
+     */
+    @Test
+    void setFrom_from_to_vacation_same() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime to = LocalTime.of(10, 0);
+        this.vacation.setTo(to);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setFrom(LocalTime.of(10,0)));
+    }
+
+    /**
+     * Tests the method {@code setFrom} with same input and ending time and vacation vacation type.
+     */
+    @Test
+    void setFrom_from_to_vacation_wrongOrder() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime to = LocalTime.of(10, 0);
+        this.vacation.setTo(to);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setFrom(LocalTime.of(20,0)));
+    }
+
+    /**
+     * Tests the method {@code setTo} with a null input, null starting time and null vacation type.
+     */
+    @Test
+    void setTo_nullTo_nullFrom_nullType_valid() {
+        this.vacation.setTo(null);
+        assertNull(this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTo} with a null input, starting time and null vacation type.
+     */
+    @Test
+    void setTo_nullTo_from_nullType_valid() {
+        this.vacation.setFrom(LocalTime.of(20, 0));
+        this.vacation.setTo(null);
+        assertNull(this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTo} with an input, null starting time and null vacation type.
+     */
+    @Test
+    void setTo_to_nullFrom_nullType_valid() {
+        LocalTime to = LocalTime.of(10,0);
+        this.vacation.setTo(to);
+        assertEquals(to, this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTo} with an input, starting time and null vacation type.
+     */
+    @Test
+    void setTo_to_from_nullType_valid() {
+        LocalTime from = LocalTime.of(10, 0);
+        this.vacation.setFrom(from);
+        LocalTime to = LocalTime.of(20,0);
+        this.vacation.setTo(to);
+        assertEquals(to, this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTo} with same input and starting time and null vacation type.
+     */
+    @Test
+    void setTo_to_from_nullType_same() {
+        LocalTime from = LocalTime.of(10, 0);
+        this.vacation.setFrom(from);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTo(LocalTime.of(10,0)));
+    }
+
+    /**
+     * Tests the method {@code setTo} with same input and starting time and null vacation type.
+     */
+    @Test
+    void setTo_to_from_nullType_wrongOrder() {
+        LocalTime from = LocalTime.of(20, 0);
+        this.vacation.setFrom(from);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTo(LocalTime.of(10,0)));
+    }
+
+    /**
+     * Tests the method {@code setTo} with a null input, null starting time and sick day vacation type.
+     */
+    @Test
+    void setTo_nullTo_nullFrom_sickDay_valid() {
+        this.vacation.setType(VacationType.SICK_DAY);
+        this.vacation.setTo(null);
+        assertNull(this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTo} with an input and sick day vacation type.
+     */
+    @Test
+    void setTo_to_sickDay() {
+        this.vacation.setType(VacationType.SICK_DAY);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTo(LocalTime.of(20,0)));
+    }
+
+    /**
+     * Tests the method {@code setTo} with a null input, null starting time and vacation vacation type.
+     */
+    @Test
+    void setTo_nullTo_vacation_valid() {
+        this.vacation.setTo(null);
+        assertNull(this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTo} with an input, null starting time and vacation vacation type.
+     */
+    @Test
+    void setTo_to_nullFrom_vacation_valid() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime to = LocalTime.of(10,0);
+        this.vacation.setTo(to);
+        assertEquals(to, this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTo} with an input, starting time and vacation vacation type.
+     */
+    @Test
+    void setTo_to_from_vacation_valid() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime from = LocalTime.of(10, 0);
+        this.vacation.setFrom(from);
+        LocalTime to = LocalTime.of(20,0);
+        this.vacation.setTo(to);
+        assertEquals(to, this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTo} with same input and starting time and vacation vacation type.
+     */
+    @Test
+    void setTo_to_from_vacation_same() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime from = LocalTime.of(10, 0);
+        this.vacation.setFrom(from);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTo(from));
+    }
+
+    /**
+     * Tests the method {@code setTo} with same input and starting time and vacation vacation type.
+     */
+    @Test
+    void setTo_to_from_vacation_wrongOrder() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime from = LocalTime.of(20, 0);
+        this.vacation.setFrom(from);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTo(LocalTime.of(10,0)));
+    }
+
+    /**
+     * Tests the method {@code setTime} with common values where no problem should occur.
+     */
+    @Test
+    void setTime_nullType_valid() {
+        LocalTime from = LocalTime.of(10,0);
+        LocalTime to = LocalTime.of(20,0);
+        this.vacation.setTime(from, to);
+        assertEquals(from, this.vacation.getFrom());
+        assertEquals(to, this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTime} with the same times.
+     */
+    @Test
+    void setTime_nullType_same() {
+        LocalTime from = LocalTime.of(10,0);
+        LocalTime to = LocalTime.of(10,0);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(from, to));
+    }
+
+    /**
+     * Tests the method {@code setTime} with later start.
+     */
+    @Test
+    void setTime_nullType_wrongOrder() {
+        LocalTime from = LocalTime.of(20,0);
+        LocalTime to = LocalTime.of(10,0);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(from, to));
+    }
+
+    /**
+     * Tests the method {@code setTime} with null {@code from} input.
+     */
+    @Test
+    void setTime_nullFrom_nullType_valid() {
+        LocalTime to = LocalTime.of(10,0);
+        this.vacation.setTime(null, to);
+        assertNull(this.vacation.getFrom());
+        assertEquals(to, this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTime} with null {@code to} input.
+     */
+    @Test
+    void setTime_nullTo_nullType_valid() {
+        LocalTime from = LocalTime.of(20,0);
+        this.vacation.setTime(from, null);
+        assertNull(this.vacation.getTo());
+        assertEquals(from, this.vacation.getFrom());
+    }
+
+    /**
+     * Tests the method {@code setTime} with null input.
+     */
+    @Test
+    void setTime_nullFrom_nullTo_nullType_valid() {
+        this.vacation.setTime(null, null);
+        assertNull(this.vacation.getFrom());
+        assertNull(this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTime} with null input and sick day vacation type.
+     */
+    @Test
+    void setTime_nullFrom_nullTo_sickDay_valid() {
+        this.vacation.setType(VacationType.SICK_DAY);
+        this.vacation.setTime(null, null);
+        assertNull(this.vacation.getFrom());
+        assertNull(this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTime} with from, null to and sick day vacation type.
+     */
+    @Test
+    void setTime_from_nullTo_sickDay() {
+        this.vacation.setType(VacationType.SICK_DAY);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(LocalTime.of(10,0), null));
+    }
+
+    /**
+     * Tests the method {@code setTime} with null from, to and sick day vacation type.
+     */
+    @Test
+    void setTime_nullFrom_to_sickDay() {
+        this.vacation.setType(VacationType.SICK_DAY);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(null, LocalTime.of(10,0)));
+    }
+
+    /**
+     * Tests the method {@code setTime} with from, to and sick day vacation type.
+     */
+    @Test
+    void setTime_from_to_sickDay() {
+        this.vacation.setType(VacationType.SICK_DAY);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(LocalTime.of(10,0), LocalTime.of(20,0)));
+    }
+
+    /**
+     * Tests the method {@code setTime} with null input and vacation vacation type.
+     */
+    @Test
+    void setTime_nullFrom_nullTo_vacation() {
+        this.vacation.setType(VacationType.VACATION);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(null, null));
+    }
+
+    /**
+     * Tests the method {@code setTime} with from, null to and vacation vacation type.
+     */
+    @Test
+    void setTime_from_nullTo_vacation() {
+        this.vacation.setType(VacationType.VACATION);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(LocalTime.of(10,0), null));
+    }
+
+    /**
+     * Tests the method {@code setTime} with null from, to and vacation vacation type.
+     */
+    @Test
+    void setTime_nullFrom_to_vacation() {
+        this.vacation.setType(VacationType.VACATION);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(null, LocalTime.of(10,0)));
+    }
+
+    /**
+     * Tests the method {@code setTime} with from, to and vacation vacation type.
+     */
+    @Test
+    void setTime_from_to_vacation_valid() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime from = LocalTime.of(10,0);
+        LocalTime to = LocalTime.of(20,0);
+        this.vacation.setTime(from, to);
+        assertEquals(from, this.vacation.getFrom());
+        assertEquals(to, this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setTime} with same from and to and vacation vacation type.
+     */
+    @Test
+    void setTime_from_to_vacation_same() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime from = LocalTime.of(10,0);
+        LocalTime to = LocalTime.of(10,0);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(from, to));
+    }
+
+    /**
+     * Tests the method {@code setTime} with later from than to and vacation vacation type.
+     */
+    @Test
+    void setTime_from_to_vacation_wrongOrder() {
+        this.vacation.setType(VacationType.VACATION);
+        LocalTime from = LocalTime.of(20,0);
+        LocalTime to = LocalTime.of(10,0);
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setTime(from, to));
+    }
+
+    /**
+     * Tests the method {@code setStatus} with common values where no problem should occur.
+     */
+    @Test
+    void setStatus_valid() {
+        this.vacation.setStatus(Status.ACCEPTED);
+        assertEquals(Status.ACCEPTED, this.vacation.getStatus());
+    }
+
+    /**
+     * Tests the method {@code setStatus} with null value.
+     */
+    @Test
+    void setStatus_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setStatus(null));
+    }
+
+    /**
+     * Tests the method {@code setType} with with vacation input.
+     */
+    @Test
+    void setType_valid() {
+        this.vacation.setType(VacationType.VACATION);
+        assertEquals(VacationType.VACATION, this.vacation.getType());
+    }
+
+    /**
+     * Tests the method {@code setType} with sick day input.
+     */
+    @Test
+    void setType_sickDay_valid() {
+        this.vacation.setType(VacationType.SICK_DAY);
+        assertEquals(VacationType.SICK_DAY, this.vacation.getType());
+        assertNull(this.vacation.getFrom());
+        assertNull(this.vacation.getTo());
+    }
+
+    /**
+     * Tests the method {@code setType} with null value.
+     */
+    @Test
+    void setType_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.vacation.setType(null));
+    }
+
+    /**
+     * Tests the method {@code toString}.
+     */
+    @Test
+    void toString_valid() {
+        Vacation vacation = new Vacation();
+        vacation.setId(5L);
+        vacation.setDate(LocalDate.of(2010,1,9));
+        vacation.setFrom(LocalTime.of(12,15));
+        vacation.setTo(LocalTime.of(22,30));
+        vacation.setCreationDate(LocalDateTime.of(2008,10,30,20,0));
+        vacation.setStatus(Status.ACCEPTED);
+        vacation.setType(VacationType.VACATION);
+        assertEquals("Vacation{id=5, date=2010-01-09, from=12:15, to=22:30, creationDate=2008-10-30T20:00, status=ACCEPTED, type=VACATION}", vacation.toString());
+    }
+
+    /**
+     * Tests the method {@code toString} for a sick day.
+     */
+    @Test
+    void toString_null() {
+        Vacation vacation = new Vacation();
+        assertEquals("Vacation{id=null, date=null, from=null, to=null, creationDate=null, status=null, type=null}", vacation.toString());
+    }
+}
