diff --git a/src/main/java/edu/group5/app/model/organization/Organization.java b/src/main/java/edu/group5/app/model/organization/Organization.java
index 885f0ed..941ed5a 100644
--- a/src/main/java/edu/group5/app/model/organization/Organization.java
+++ b/src/main/java/edu/group5/app/model/organization/Organization.java
@@ -15,8 +15,14 @@
*
description must not be null
*
*/
-public record Organization(int orgNumber, String name, boolean trusted, String websiteURL, boolean isPreApproved,
- String description) {
+public record Organization(
+ int orgNumber,
+ String name,
+ boolean trusted,
+ String websiteURL,
+ boolean isPreApproved,
+ String description
+) {
/**
* Creates a new organization.
*
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 3b086c3..7f1b898 100644
--- a/src/test/java/edu/group5/app/model/organization/OrganizationTest.java
+++ b/src/test/java/edu/group5/app/model/organization/OrganizationTest.java
@@ -5,82 +5,97 @@
import static org.junit.jupiter.api.Assertions.*;
class OrganizationTest {
-
+
+ @Test
+ void constructor_CreatesAnOrganizationWhenInputIsValid() {
+ Organization org = new Organization(
+ 1,
+ "Org",
+ true,
+ "org.com",
+ true,
+ "Org description"
+ );
+
+ assertAll(
+ () -> assertEquals(1, org.orgNumber()),
+ () -> assertEquals("Org", org.name()),
+ () -> assertTrue(org.trusted()),
+ () -> assertEquals("org.com", org.websiteURL()),
+ () -> assertTrue(org.isPreApproved()),
+ () -> assertEquals("Org description", org.description())
+ );
+ }
+
@Test
void constructor_ThrowsWhenOrgNumberIsNegative() {
- assertThrows(IllegalArgumentException.class, () -> {new Organization(
+ assertThrows(IllegalArgumentException.class, () -> new Organization(
-1,
"Org",
true,
- null,
+ "org.com",
true,
"Org description"
- );
- });
+ ));
}
@Test
void constructor_ThrowsWhenNameIsNull() {
- assertThrows(NullPointerException.class, () -> {new Organization(
+ assertThrows(NullPointerException.class, () -> new Organization(
1,
null,
true,
"org.com",
true,
"Org description"
- );
- });
+ ));
}
@Test
void constructor_ThrowsWhenNameIsBlank() {
- assertThrows(IllegalArgumentException.class, () -> {new Organization(
+ assertThrows(IllegalArgumentException.class, () -> new Organization(
1,
"",
true,
"org.com",
true,
"Org description"
- );
- });
+ ));
}
@Test
void constructor_ThrowsWhenWebsiteURLIsNull() {
- assertThrows(NullPointerException.class, () -> {new Organization(
+ assertThrows(NullPointerException.class, () -> new Organization(
1,
"Org",
true,
null,
true,
"Org description"
- );
- });
+ ));
}
@Test
void constructor_ThrowsWhenWebsiteURLIsBlank() {
- assertThrows(IllegalArgumentException.class, () -> {new Organization(
+ assertThrows(IllegalArgumentException.class, () -> new Organization(
1,
"Org",
true,
"",
true,
"Org description"
- );
- });
+ ));
}
@Test
void constructor_ThrowsWhenDescriptionIsNull() {
- assertThrows(NullPointerException.class, () -> {new Organization(
+ assertThrows(NullPointerException.class, () -> new Organization(
1,
"Org",
true,
"org.com",
true,
null
- );
- });
+ ));
}
}
\ No newline at end of file