settings
This commit is contained in:
parent
909e241c5b
commit
b65ed726c7
@ -17,14 +17,14 @@ import app.model.Model;
|
|||||||
|
|
||||||
public class SettingsProvider implements SettingsProviderI {
|
public class SettingsProvider implements SettingsProviderI {
|
||||||
|
|
||||||
private static EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
|
||||||
private static final String SETTINGS_PATH =
|
private String SETTINGS_PATH =
|
||||||
(System.getProperty("os.name").startsWith("Windows"))
|
(System.getProperty("os.name").startsWith("Windows"))
|
||||||
? System.getProperty("user.home") + "\\AppData\\Roaming\\/BNNsettings.dat"
|
? System.getProperty("user.home") + "\\AppData\\Roaming\\/BNNsettings.dat"
|
||||||
: System.getProperty("user.home") + System.getProperty("file.separator") + ".BNNsettings.dat";
|
: System.getProperty("user.home") + System.getProperty("file.separator") + ".BNNsettings.dat";
|
||||||
|
|
||||||
private static List<String> legalSettings =
|
private List<String> legalSettings =
|
||||||
Arrays.asList("Java", "Markdown", "Monokai", "Solarized Light");
|
Arrays.asList("Java", "Markdown", "Monokai", "Solarized Light");
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class SettingsProvider implements SettingsProviderI {
|
|||||||
|
|
||||||
public void setEventBus(EventBus eB) {
|
public void setEventBus(EventBus eB) {
|
||||||
eventBus = eB;
|
eventBus = eB;
|
||||||
SettingsProvider.eventBus.register(this);
|
eventBus.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,21 +1,35 @@
|
|||||||
package app.settings;
|
package app.settings;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.eventbus.EventBus;
|
||||||
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
|
||||||
public class SettingsProviderTest {
|
public class SettingsProviderTest {
|
||||||
|
|
||||||
@Mock
|
@TempDir
|
||||||
private static final String SETTINGS_PATH =
|
File tmp;
|
||||||
(System.getProperty("os.name").startsWith("Windows"))
|
|
||||||
? System.getProperty("user.home") + "\\AppData\\Roaming\\/BNNsettings.dat"
|
|
||||||
: System.getProperty("user.home") + System.getProperty("file.separator") + ".BNNsettings.dat";
|
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private static List<String> legalSettings =
|
private String SETTINGS_PATH = Paths.get(tmp.toPath().toString(), "BNNsetting.dat").toString();
|
||||||
|
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private List<String> legalSettings =
|
||||||
Arrays.asList("Java", "Markdown", "Monokai", "Solarized Light");
|
Arrays.asList("Java", "Markdown", "Monokai", "Solarized Light");
|
||||||
|
|
||||||
private static EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
|
||||||
|
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
@ -23,8 +37,9 @@ public class SettingsProviderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Test load settings")
|
@DisplayName("Test load settings")
|
||||||
public void testLoadSettings() {
|
public void testLoadSettings() throws IOException {
|
||||||
sp.when()
|
File f = new File(tmp, "test.txt");
|
||||||
|
f.createNewFile();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user