Skip to content

Commit

Permalink
test: made unit tests for Organization
Browse files Browse the repository at this point in the history
  • Loading branch information
emilfa committed Feb 26, 2026
1 parent 51a85e6 commit fbbdab4
Showing 1 changed file with 82 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
);
});
}
}

0 comments on commit fbbdab4

Please sign in to comment.