commit adaf7531f1057b91f4f02d38a24aeaac25791bf4
Author: Pavel Fidransky <pavel.fidransky@yoso.fi>
Date:   Mon Jul 13 10:16:07 2020 +0200

    re #42 add tests of DefaultSettingsDTO

diff --git a/server/src/test/java/org/danekja/ymanager/domain/DefaultSettingsDTOTest.java b/server/src/test/java/org/danekja/ymanager/domain/DefaultSettingsDTOTest.java
deleted file mode 100644
index dfbf4c2..0000000
--- a/server/src/test/java/org/danekja/ymanager/domain/DefaultSettingsDTOTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.danekja.ymanager.domain;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.time.LocalDateTime;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-/**
- * This class tests methods of the {@code DefaultSettings} class.
- * @see DefaultSettings
- */
-class DefaultSettingsDTOTest {
-
-    /**
-     * The empty instance of the {@code DefaultSettings}.
-     */
-    private DefaultSettings defaultSettings;
-
-    /**
-     * Prepares the instance of the {@code DefaultSettings}.
-     */
-    @BeforeEach
-    void setUp() {
-        this.defaultSettings = new DefaultSettings();
-    }
-
-    /**
-     * Tests the method {@code setSickDayCount} with common values where no problem should occur.
-     */
-    @Test
-    void setSickDaysCount_valid() {
-        this.defaultSettings.setSickDayCount(10);
-        assertEquals(10, this.defaultSettings.getSickDayCount());
-    }
-
-    /**
-     * Tests the method {@code setSickDayCount} with zero which is a threshold value.
-     */
-    @Test
-    void setSickDaysCount_zeroInput() {
-        this.defaultSettings.setSickDayCount(0);
-        assertEquals(0, this.defaultSettings.getSickDayCount());
-    }
-
-    /**
-     * Tests the method {@code setSickDayCount} with negative one which is a threshold value.
-     */
-    @Test
-    void setSickDaysCount_negativeOneInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setSickDayCount(-1));
-    }
-
-    /**
-     * Tests the method {@code setSickDayCount} with negative value.
-     */
-    @Test
-    void setSickDaysCount_negativeInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setSickDayCount(-10));
-    }
-
-    /**
-     * Tests the method {@code setSickDayCount} with null value.
-     */
-    @Test
-    void setSickDaysCount_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setSickDayCount(null));
-    }
-
-    /**
-     * Tests the method {@code setNotification} with common values where no problem should occur.
-     */
-    @Test
-    void setNotification_valid() {
-        this.defaultSettings.setNotification(LocalDateTime.of(2010,5,1,20,0));
-        assertEquals(LocalDateTime.of(2010,5,1,20,0), this.defaultSettings.getNotification());
-    }
-
-    /**
-     * Tests the method {@code setNotification} with null value.
-     */
-    @Test
-    void setNotification_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setNotification(null));
-    }
-
-    /**
-     * Tests the method {@code toString}.
-     */
-    @Test
-    void testToString() {
-        DefaultSettings defaultSettings = new DefaultSettings();
-        defaultSettings.setId(5L);
-        defaultSettings.setSickDayCount(1);
-        defaultSettings.setNotification(LocalDateTime.of(2008,10,30,20,0));
-        assertEquals("DefaultSettings{id=5, sickDayCount=1, notification=2008-10-30T20:00}", defaultSettings.toString());
-    }
-}
diff --git a/server/src/test/java/org/danekja/ymanager/domain/DefaultSettingsTest.java b/server/src/test/java/org/danekja/ymanager/domain/DefaultSettingsTest.java
new file mode 100644
index 0000000..a30fbc8
--- /dev/null
+++ b/server/src/test/java/org/danekja/ymanager/domain/DefaultSettingsTest.java
@@ -0,0 +1,99 @@
+package org.danekja.ymanager.domain;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.time.LocalDateTime;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * This class tests methods of the {@link DefaultSettings} class.
+ */
+class DefaultSettingsTest {
+
+    /**
+     * The empty instance of the {@code DefaultSettings}.
+     */
+    private DefaultSettings defaultSettings;
+
+    /**
+     * Prepares the instance of the {@code DefaultSettings}.
+     */
+    @BeforeEach
+    void setUp() {
+        this.defaultSettings = new DefaultSettings();
+    }
+
+    /**
+     * Tests the method {@code setSickDayCount} with common values where no problem should occur.
+     */
+    @Test
+    void setSickDaysCount_valid() {
+        this.defaultSettings.setSickDayCount(10);
+        assertEquals(10, this.defaultSettings.getSickDayCount());
+    }
+
+    /**
+     * Tests the method {@code setSickDayCount} with zero which is a threshold value.
+     */
+    @Test
+    void setSickDaysCount_zeroInput() {
+        this.defaultSettings.setSickDayCount(0);
+        assertEquals(0, this.defaultSettings.getSickDayCount());
+    }
+
+    /**
+     * Tests the method {@code setSickDayCount} with negative one which is a threshold value.
+     */
+    @Test
+    void setSickDaysCount_negativeOneInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setSickDayCount(-1));
+    }
+
+    /**
+     * Tests the method {@code setSickDayCount} with negative value.
+     */
+    @Test
+    void setSickDaysCount_negativeInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setSickDayCount(-10));
+    }
+
+    /**
+     * Tests the method {@code setSickDayCount} with null value.
+     */
+    @Test
+    void setSickDaysCount_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setSickDayCount(null));
+    }
+
+    /**
+     * Tests the method {@code setNotification} with common values where no problem should occur.
+     */
+    @Test
+    void setNotification_valid() {
+        this.defaultSettings.setNotification(LocalDateTime.of(2010,5,1,20,0));
+        assertEquals(LocalDateTime.of(2010,5,1,20,0), this.defaultSettings.getNotification());
+    }
+
+    /**
+     * Tests the method {@code setNotification} with null value.
+     */
+    @Test
+    void setNotification_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> this.defaultSettings.setNotification(null));
+    }
+
+    /**
+     * Tests the method {@code toString}.
+     */
+    @Test
+    void testToString() {
+        DefaultSettings defaultSettings = new DefaultSettings();
+        defaultSettings.setId(5L);
+        defaultSettings.setSickDayCount(1);
+        defaultSettings.setNotification(LocalDateTime.of(2008,10,30,20,0));
+        assertEquals("DefaultSettings{id=5, sickDayCount=1, notification=2008-10-30T20:00}", defaultSettings.toString());
+    }
+}
diff --git a/server/src/test/java/org/danekja/ymanager/dto/DefaultSettingsDTOTest.java b/server/src/test/java/org/danekja/ymanager/dto/DefaultSettingsDTOTest.java
new file mode 100644
index 0000000..743594d
--- /dev/null
+++ b/server/src/test/java/org/danekja/ymanager/dto/DefaultSettingsDTOTest.java
@@ -0,0 +1,48 @@
+package org.danekja.ymanager.dto;
+
+import org.danekja.ymanager.domain.DefaultSettings;
+import org.junit.jupiter.api.Test;
+
+import java.time.LocalDateTime;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Unit tests of {@link DefaultSettingsDTO}.
+ */
+class DefaultSettingsDTOTest {
+    @Test
+    void constructor_noArguments() {
+        DefaultSettingsDTO defaultSettingsDTO = new DefaultSettingsDTO();
+
+        assertNull(defaultSettingsDTO.getNotification());
+        assertNull(defaultSettingsDTO.getSickDayCount());
+    }
+
+    @Test
+    void constructor_properties() {
+        DefaultSettingsDTO defaultSettingsDTO = new DefaultSettingsDTO(5, LocalDateTime.MAX);
+
+        assertEquals(5, (int) defaultSettingsDTO.getSickDayCount());
+        assertEquals(LocalDateTime.MAX, defaultSettingsDTO.getNotification());
+    }
+
+    @Test
+    void constructor_domainObject() {
+        DefaultSettings defaultSettings = new DefaultSettings(5, LocalDateTime.MAX);
+        DefaultSettingsDTO defaultSettingsDTO = new DefaultSettingsDTO(defaultSettings);
+
+        assertEquals(5, (int) defaultSettingsDTO.getSickDayCount());
+        assertEquals(LocalDateTime.MAX, defaultSettingsDTO.getNotification());
+    }
+
+    @Test
+    void toEntity() {
+        DefaultSettingsDTO defaultSettingsDTO = new DefaultSettingsDTO(5, LocalDateTime.MAX);
+        DefaultSettings defaultSettings = defaultSettingsDTO.toEntity();
+
+        assertEquals(5, defaultSettings.getSickDayCount());
+        assertEquals(LocalDateTime.MAX, defaultSettings.getNotification());
+    }
+}
