diff --git a/src/test/java/no/ntnu/idatt1002/demo/data/ItemTest.java b/src/test/java/no/ntnu/idatt1002/demo/data/ItemTest.java index ba055e336b8e1b4fe570b138f60ebd79d53f7841..f9b098b0b8655a834c29e3a9ff8df4a223cc6678 100644 --- a/src/test/java/no/ntnu/idatt1002/demo/data/ItemTest.java +++ b/src/test/java/no/ntnu/idatt1002/demo/data/ItemTest.java @@ -10,17 +10,14 @@ class ItemTest { @Test @DisplayName("The Item constructor throws exceptions when it should.") void constructorThrows(){ - Exception noCategory = assertThrows(IllegalArgumentException.class, () -> new Item(null, "description", 89.9f)); - assertEquals("The item must have a category and a price.", noCategory.getMessage()); - - Exception noPrice = assertThrows(IllegalArgumentException.class, () -> new Item(ExpenseCategory.OTHER, "description", 0f)); - assertEquals("The item must have a category and a price.", noPrice.getMessage()); + assertThrows(IllegalArgumentException.class, () -> new Item("description", 89.9f, true)); + assertThrows(IllegalArgumentException.class, () -> new Item("description", 0f, false)); }; @Test @DisplayName("The Item constructor does not throw exceptions when it should not.") void constructorDoesThrow() { - assertDoesNotThrow(() -> new Item(ExpenseCategory.OTHER, "descriotion", 59.9f)); + assertDoesNotThrow(() -> new Item("description", 59.9f, false)); } } \ No newline at end of file