Skip to content

Commit

Permalink
Fix: Small fixes and deleted organizationTest
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBalunan committed Mar 15, 2026
1 parent facf2fc commit ac74eff
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


public class Main {
// Make sure you're connected to the NTNU network for this to work
public static void main(String[] args) {
HmHApplication.main(args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ public DatabaseConnection() {
this.username = "apbaluna";
this.password = "GYntUFPG";

if (this.databaseURL == null || this.databaseURL.isBlank()) {
throw new IllegalStateException("Database environment variable URL has not been set");
}

if (this.username == null || this.username.isBlank()) {
throw new IllegalStateException("Username environment variable has not been set");
}

if (this.password == null || this.password.isBlank()) {
throw new IllegalStateException("Password environment variable has not been set");
}
}

/**
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package ntnu.systemutvikling.team6.scraper;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

class APICharityDataTest {

@Test
void initialParametersShouldBeCorrect() {
APICharityData charity =
new APICharityData(
"938419264",
"Misjonsalliansen",
"approved",
"https://www.innsamlingskontrollen.no/organisasjoner/misjonsalliansen/",
false);

assertEquals(
"938419264",
charity.getOrg_number(),
"Org_number parameter of APICharityData should be correct.");
assertEquals(
"Misjonsalliansen",
charity.getName(),
"Name parameter of APICharityData should be correct.");
assertEquals(
"approved", charity.getStatus(), "Status parameter of APICharityData should be correct.");
assertEquals(
"https://www.innsamlingskontrollen.no/organisasjoner/misjonsalliansen/",
charity.getUrl(),
"Url parameter of APICharityData should be correct.");
assertFalse(
charity.getIs_pre_approved(),
"Is_pre_approved parameter of APICharityData should " + "be correct.");
}

@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.");
}
}

0 comments on commit ac74eff

Please sign in to comment.