From fbbdab4b439806938429819006c2d7ce8305b45e Mon Sep 17 00:00:00 2001 From: emilfa Date: Thu, 26 Feb 2026 10:48:02 +0100 Subject: [PATCH] test: made unit tests for Organization --- .../model/organization/OrganizationTest.java | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/src/test/java/edu/group5/app/model/organization/OrganizationTest.java b/src/test/java/edu/group5/app/model/organization/OrganizationTest.java index 557c0c0..3b086c3 100644 --- a/src/test/java/edu/group5/app/model/organization/OrganizationTest.java +++ b/src/test/java/edu/group5/app/model/organization/OrganizationTest.java @@ -1,4 +1,86 @@ +package edu.group5.app.model.organization; + +import org.junit.jupiter.api.Test; + import static org.junit.jupiter.api.Assertions.*; + class OrganizationTest { + @Test + void constructor_ThrowsWhenOrgNumberIsNegative() { + assertThrows(IllegalArgumentException.class, () -> {new Organization( + -1, + "Org", + true, + null, + true, + "Org description" + ); + }); + } + + @Test + void constructor_ThrowsWhenNameIsNull() { + assertThrows(NullPointerException.class, () -> {new Organization( + 1, + null, + true, + "org.com", + true, + "Org description" + ); + }); + } + + @Test + void constructor_ThrowsWhenNameIsBlank() { + assertThrows(IllegalArgumentException.class, () -> {new Organization( + 1, + "", + true, + "org.com", + true, + "Org description" + ); + }); + } + + @Test + void constructor_ThrowsWhenWebsiteURLIsNull() { + assertThrows(NullPointerException.class, () -> {new Organization( + 1, + "Org", + true, + null, + true, + "Org description" + ); + }); + } + + @Test + void constructor_ThrowsWhenWebsiteURLIsBlank() { + assertThrows(IllegalArgumentException.class, () -> {new Organization( + 1, + "Org", + true, + "", + true, + "Org description" + ); + }); + } + + @Test + void constructor_ThrowsWhenDescriptionIsNull() { + assertThrows(NullPointerException.class, () -> {new Organization( + 1, + "Org", + true, + "org.com", + true, + null + ); + }); + } } \ No newline at end of file