Skip to content

Commit

Permalink
Updated APICharityDataTest
Browse files Browse the repository at this point in the history
Added tests for new logic regarding org_number.
  • Loading branch information
roaraf committed Mar 4, 2026
1 parent 9cb3206 commit a723ced
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,39 @@ void initialParametersShouldBeCorrect() {

}

@Test
void org_numberWhiteSpaceShouldBeremoved() {
String org_number = "938 4192 64";
APICharityData charity = new APICharityData(
org_number, "Misjonsalliansen", "approved",
"https://www.innsamlingskontrollen.no/organisasjoner/misjonsalliansen/", false
);

assertEquals(org_number.replaceAll("\\s",""), charity.getOrg_number(),
"Org_number should not contain whitespace.");
}

@Test
void nullOrg_numberShouldThrowIllegalArgumentException() {
assertThrows(IllegalArgumentException.class, () -> new APICharityData(null, "Misjonsalliansen",
"approved", "https://www.innsamlingskontrollen.no/organisasjoner/misjonsalliansen/",
false), "Null org_number should not be allowed.");
}

@Test
void blankOrg_numberShouldThrowIllegalArgumentException() {
assertThrows(IllegalArgumentException.class, () -> new APICharityData(" ", "Misjonsalliansen",
"approved", "https://www.innsamlingskontrollen.no/organisasjoner/misjonsalliansen/",
false), "Blank org_number should not be allowed.");
}

@Test
void emptyOrg_numberShouldThrowIllegalArgumentException() {
assertThrows(IllegalArgumentException.class, () -> new APICharityData("", "Misjonsalliansen",
"approved", "https://www.innsamlingskontrollen.no/organisasjoner/misjonsalliansen/",
false), "Null org_number should not be allowed.");
}




Expand Down

0 comments on commit a723ced

Please sign in to comment.