From 385a08612ccf120b3feda1b171b12b22071c8f0a Mon Sep 17 00:00:00 2001
From: Andreas <andreksv@ntnu.no>
Date: Tue, 21 Mar 2023 17:30:40 +0100
Subject: [PATCH] Added test textfiles for Filehandling

---
 .../resources/Economics/expenseRegisterTest.register |  6 ++++++
 .../resources/Economics/incomeRegisterTest.register  |  6 ++++++
 .../idatt1002/demo/data/Economics/ExpenseTest.java   |  4 +---
 .../demo/data/Economics/FileHandlingTest.java        | 12 ++++++------
 4 files changed, 19 insertions(+), 9 deletions(-)
 create mode 100644 src/main/resources/Economics/expenseRegisterTest.register
 create mode 100644 src/main/resources/Economics/incomeRegisterTest.register

diff --git a/src/main/resources/Economics/expenseRegisterTest.register b/src/main/resources/Economics/expenseRegisterTest.register
new file mode 100644
index 00000000..c7d08411
--- /dev/null
+++ b/src/main/resources/Economics/expenseRegisterTest.register
@@ -0,0 +1,6 @@
+date=03.03.23
+description=description
+amount=59.900001525878906
+isReoccuring=Not reoccurring
+category=CLOTHES
+
diff --git a/src/main/resources/Economics/incomeRegisterTest.register b/src/main/resources/Economics/incomeRegisterTest.register
new file mode 100644
index 00000000..0b3082de
--- /dev/null
+++ b/src/main/resources/Economics/incomeRegisterTest.register
@@ -0,0 +1,6 @@
+date=03.03.23
+description=description
+amount=59.900001525878906
+isReoccuring=Not reoccurring
+category=GIFT
+
diff --git a/src/test/java/no/ntnu/idatt1002/demo/data/Economics/ExpenseTest.java b/src/test/java/no/ntnu/idatt1002/demo/data/Economics/ExpenseTest.java
index 338f63fb..191c8513 100644
--- a/src/test/java/no/ntnu/idatt1002/demo/data/Economics/ExpenseTest.java
+++ b/src/test/java/no/ntnu/idatt1002/demo/data/Economics/ExpenseTest.java
@@ -1,7 +1,5 @@
 package no.ntnu.idatt1002.demo.data.Economics;
 
-import no.ntnu.idatt1002.demo.data.Economics.Expense;
-import no.ntnu.idatt1002.demo.data.Economics.ExpenseCategory;
 import org.junit.jupiter.api.DisplayName;
 import org.junit.jupiter.api.Test;
 
@@ -14,7 +12,7 @@ class ExpenseTest {
     void constructorThrows(){
         assertThrows(IllegalArgumentException.class, () -> new Expense("description", 8.5f, false, null, "03.03.23"));
         assertThrows(IllegalArgumentException.class, () -> new Expense("description", -10.0f, false, ExpenseCategory.BOOKS, "03.03.23"));
-    };
+    }
 
     @Test
     @DisplayName("The Expense constructor does not throw exceptions when it should not.")
diff --git a/src/test/java/no/ntnu/idatt1002/demo/data/Economics/FileHandlingTest.java b/src/test/java/no/ntnu/idatt1002/demo/data/Economics/FileHandlingTest.java
index aaa5097a..59ffe367 100644
--- a/src/test/java/no/ntnu/idatt1002/demo/data/Economics/FileHandlingTest.java
+++ b/src/test/java/no/ntnu/idatt1002/demo/data/Economics/FileHandlingTest.java
@@ -23,7 +23,7 @@ class FileHandlingTest {
             }
             @Test
             @DisplayName("Writing to file does not throw exception")
-            void writingToFileDoesNotThrowException() throws IOException {
+            void writingToFileDoesNotThrowException() {
                 assertDoesNotThrow(()->fileHandling.writeItemRegisterToFile(incomeRegister, fileTitle));
             }
 
@@ -43,7 +43,7 @@ class FileHandlingTest {
             }
             @Test
             @DisplayName("Writing to file does not throw exception")
-            void writingToFileDoesNotThrowException() throws IOException {
+            void writingToFileDoesNotThrowException() {
                 assertDoesNotThrow(()->fileHandling.writeItemRegisterToFile(incomeRegister, fileTitle));
             }
 
@@ -67,7 +67,7 @@ class FileHandlingTest {
             }
             @Test
             @DisplayName("Writing to file does not throw exception")
-            void writingToFileDoesNotThrowException() throws IOException {
+            void writingToFileDoesNotThrowException() {
                 assertDoesNotThrow(()->fileHandling.writeItemRegisterToFile(incomeRegister, fileTitle));
             }
 
@@ -92,7 +92,7 @@ class FileHandlingTest {
             }
             @Test
             @DisplayName("Writing to file does not throw exception")
-            void writingToFileDoesNotThrowException() throws IOException {
+            void writingToFileDoesNotThrowException() {
                 assertDoesNotThrow(()->fileHandling.writeItemRegisterToFile(expenseRegister, fileTitle));
             }
 
@@ -112,7 +112,7 @@ class FileHandlingTest {
             }
             @Test
             @DisplayName("Writing to file does not throw exception")
-            void writingToFileDoesNotThrowException() throws IOException {
+            void writingToFileDoesNotThrowException() {
                 assertDoesNotThrow(()->fileHandling.writeItemRegisterToFile(expenseRegister, fileTitle));
             }
 
@@ -137,7 +137,7 @@ class FileHandlingTest {
             }
             @Test
             @DisplayName("Writing to file does not throw exception")
-            void writingToFileDoesNotThrowException() throws IOException {
+            void writingToFileDoesNotThrowException() {
                 assertDoesNotThrow(()->fileHandling.writeItemRegisterToFile(expenseRegister, fileTitle));
             }
 
-- 
GitLab