-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: made unit tests for Organization
- Loading branch information
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
src/test/java/edu/group5/app/model/organization/OrganizationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ); | ||
| }); | ||
| } | ||
| } |