43 lines
1.0 KiB
Java
43 lines
1.0 KiB
Java
package de.rwu.easydrop.util;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
import static org.mockito.Mockito.spy;
|
|
|
|
import javax.naming.ConfigurationException;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.mockito.MockitoAnnotations;
|
|
|
|
class ConfigTest {
|
|
private Config config;
|
|
|
|
@BeforeEach
|
|
void setUp() throws ConfigurationException {
|
|
MockitoAnnotations.openMocks(this);
|
|
config = spy(Config.getInstance());
|
|
}
|
|
|
|
@Test
|
|
void testGetInstanceNull() {
|
|
config = null;
|
|
|
|
Config newConfig = Config.getInstance();
|
|
assertNotNull(newConfig);
|
|
}
|
|
|
|
@Test
|
|
void testGetInstanceNotNull() {
|
|
Config newConfig = Config.getInstance();
|
|
assertNotNull(newConfig);
|
|
}
|
|
|
|
@Test
|
|
void testSetConfigLocation() {
|
|
String newPath = "new/location/config.properties";
|
|
config.setConfigLocation(newPath);
|
|
assertEquals(newPath, config.getConfigLocation());
|
|
}
|
|
}
|