-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
881078a
commit 66d34ce
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
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
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
52 changes: 52 additions & 0 deletions
52
src/test/java/fr/insee/rmes/config/keycloak/ServerZoneTest.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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package fr.insee.rmes.config.keycloak; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class ServerZoneTest { | ||
|
||
private ServerZone serverZone; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
serverZone = new ServerZone(); | ||
} | ||
|
||
@Test | ||
void testSetZone_withValidZone() { | ||
String validZone = "INTERNE"; | ||
|
||
serverZone.setZone(validZone); | ||
|
||
assertEquals(ServerZone.Zone.INTERNE, serverZone.zone()); | ||
} | ||
|
||
@Test | ||
void testSetZone_withInvalidZone_logsWarningAndSetsDefaultZone() { | ||
String invalidZone = "INVALID_ZONE"; | ||
|
||
serverZone.setZone(invalidZone); | ||
|
||
assertEquals(ServerZone.Zone.defaultZone(), serverZone.zone()); | ||
} | ||
|
||
@Test | ||
void testConstructor_withValidZone() { | ||
String validZone = "DMZ"; | ||
|
||
ServerZone serverZone = new ServerZone(validZone); | ||
|
||
assertEquals(ServerZone.Zone.DMZ, serverZone.zone()); | ||
} | ||
|
||
@Test | ||
void testConstructor_withInvalidZone_logsWarningAndSetsDefaultZone() { | ||
String invalidZone = "UNKNOWN"; | ||
|
||
ServerZone serverZone = new ServerZone(invalidZone); | ||
|
||
assertEquals(ServerZone.Zone.defaultZone(), serverZone.zone()); | ||
} | ||
} |