mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-23 13:11:28 +00:00
Remove hard coded default locations for admin config
This commit is contained in:
@@ -13,9 +13,13 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.hamcrest.Matchers.anEmptyMap;
|
||||
import static org.hamcrest.Matchers.hasEntry;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mockStatic;
|
||||
import static org.mockito.Mockito.never;
|
||||
|
||||
public class AdminPropertiesSetterTest {
|
||||
|
||||
@@ -74,4 +78,19 @@ public class AdminPropertiesSetterTest {
|
||||
MatcherAssert.assertThat(properties, anEmptyMap());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("If system property for config path is null, skip do not load anything")
|
||||
void skipAdjustSystemPropertiesOnUndefinedProperty() {
|
||||
Assertions.assertNull(System.getProperty("cryptomator.adminConfig"));
|
||||
|
||||
try (var adminPropSetterMock = mockStatic(AdminPropertiesSetter.class)) {
|
||||
adminPropSetterMock.when(AdminPropertiesSetter::adjustSystemProperties).thenCallRealMethod();
|
||||
adminPropSetterMock.when(() -> AdminPropertiesSetter.loadAdminProperties(any())).thenReturn(new Properties());
|
||||
|
||||
AdminPropertiesSetter.adjustSystemProperties();
|
||||
|
||||
adminPropSetterMock.verify(() -> AdminPropertiesSetter.loadAdminProperties(any()), never());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user