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