Skip to content

Commit 82872c4

Browse files
committed
fix existing tests
1 parent eb6004a commit 82872c4

5 files changed

Lines changed: 13 additions & 21 deletions

File tree

src/main/java/de/leonhard/storage/internal/editor/toml/TomlManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import de.leonhard.storage.util.FastStringWriter;
55
import java.io.*;
66
import java.nio.charset.StandardCharsets;
7+
import java.nio.file.Files;
78
import java.time.format.DateTimeFormatter;
89
import java.time.format.DateTimeFormatterBuilder;
910
import java.util.Map;
@@ -159,7 +160,7 @@ public Map<String, Object> read(final File file) throws IOException, TomlExcepti
159160
*/
160161
public Map<String, Object> read(final File file, final boolean strictAsciiBareKeys)
161162
throws IOException, TomlException {
162-
return read(new FileInputStream(file), strictAsciiBareKeys);
163+
return read(Files.newInputStream(file.toPath()), strictAsciiBareKeys);
163164
}
164165

165166
/**

src/test/java/de/leonhard/storage/ConfigTest.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import de.leonhard.storage.annotation.ConfigPath;
44
import de.leonhard.storage.internal.exceptions.SimplixValidationException;
55
import de.leonhard.storage.internal.settings.DataType;
6+
import lombok.Getter;
67
import org.junit.jupiter.api.AfterAll;
78
import org.junit.jupiter.api.Assertions;
89
import org.junit.jupiter.api.BeforeEach;
@@ -89,25 +90,18 @@ void testAnnotations() {
8990
}
9091

9192
@AfterAll
92-
@Test
9393
static void tearDown() {
9494
config.clear();
9595
Assertions.assertTrue(config.getFile().delete());
9696
}
9797

98+
@Getter
9899
static class AnnotationTests {
99100

100101
@ConfigPath("annotation-test")
101102
public String annotationTest;
103+
102104
@ConfigPath("section.annotations")
103105
public Integer annotationTest2;
104-
105-
public String getAnnotationTest() {
106-
return annotationTest;
107-
}
108-
109-
public int getAnnotationTest2() {
110-
return annotationTest2;
111-
}
112106
}
113107
}

src/test/java/de/leonhard/storage/JsonTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ public class JsonTest {
1717
@Test
1818
void setUp() {
1919
json = new Json("Example", "");
20-
Assertions.assertEquals("Example.yml", json.getName());
20+
Assertions.assertEquals("Example.json", json.getName());
2121
}
2222

2323
@Test
2424
void testGetDataType() {
25-
Assertions.assertEquals(json.getDataType(), DataType.SORTED);
25+
Assertions.assertEquals(json.getDataType(), DataType.UNSORTED);
2626
}
2727

2828
@Test
@@ -68,8 +68,7 @@ void testSet() {
6868
}
6969

7070
@AfterAll
71-
@Test
72-
void tearDown() {
71+
static void tearDown() {
7372
json.clear();
7473
Assertions.assertTrue(json.getFile().delete());
7574
}

src/test/java/de/leonhard/storage/TomlTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ public class TomlTest {
1717
@Test
1818
void setUp() {
1919
toml = new Toml("Example", "");
20-
Assertions.assertEquals("Example.yml", toml.getName());
20+
Assertions.assertEquals("Example.toml", toml.getName());
2121
}
2222

2323
@Test
2424
void testGetDataType() {
25-
Assertions.assertEquals(DataType.SORTED, toml.getDataType());
25+
Assertions.assertEquals(DataType.UNSORTED, toml.getDataType());
2626
}
2727

2828
@Test
@@ -68,8 +68,7 @@ void testSet() {
6868
}
6969

7070
@AfterAll
71-
@Test
72-
void tearDown() {
71+
static void tearDown() {
7372
toml.clear();
7473
Assertions.assertTrue(toml.getFile().delete());
7574
}

src/test/java/de/leonhard/storage/YamlTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void setUp() {
2626

2727
@Test
2828
void testGetDataType() {
29-
Assertions.assertEquals(DataType.SORTED, yaml.getDataType());
29+
Assertions.assertEquals(DataType.UNSORTED, yaml.getDataType());
3030
}
3131

3232
@Test
@@ -78,8 +78,7 @@ void testSet() {
7878
}
7979

8080
@AfterAll
81-
@Test
82-
void tearDown() {
81+
static void tearDown() {
8382
yaml.clear();
8483
Assertions.assertTrue(yaml.getFile().delete());
8584
}

0 commit comments

Comments
 (0)