Adjusted Config tests for proper singleton pattern
This commit is contained in:
@@ -2,6 +2,7 @@ package de.rwu.easydrop.util;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
@@ -20,17 +21,18 @@ class ConfigTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetInstanceNull() {
|
||||
config = null;
|
||||
|
||||
void testGetInstance() {
|
||||
Config newConfig = Config.getInstance();
|
||||
assertNotNull(newConfig);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetInstanceNotNull() {
|
||||
Config newConfig = Config.getInstance();
|
||||
assertNotNull(newConfig);
|
||||
void testGetInstanceEquality() {
|
||||
// Create "two" instances to check validity of Singleton pattern
|
||||
Config instance1 = Config.getInstance();
|
||||
Config instance2 = Config.getInstance();
|
||||
|
||||
assertSame(instance1, instance2, "Instances should be equal");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user