Skip to content

Commit c97db77

Browse files
committed
Apply linter suggestions
1 parent e6b2064 commit c97db77

File tree

2 files changed

+60
-59
lines changed

2 files changed

+60
-59
lines changed
Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
package org.example;
22

3-
import org.junit.jupiter.api.Tag;
4-
import org.junit.jupiter.api.Test;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
54

65
import java.nio.file.Path;
76
import java.nio.file.Paths;
8-
9-
import static org.junit.jupiter.api.Assertions.assertEquals;
7+
import org.junit.jupiter.api.Tag;
8+
import org.junit.jupiter.api.Test;
109

1110
public class StringifyFileContentsTest {
1211

13-
@Test
14-
@Tag("unit")
15-
void testValidFile() {
16-
Path fp = Paths.get("src/test/resources");
17-
String stringFromFile = StringifyFileContents.toString("a-text-file.txt", fp);
18-
assertEquals(stringFromFile, "The quick brown fox jumps over the lazy dog");
19-
}
12+
@Test
13+
@Tag("unit")
14+
void testValidFile() {
15+
Path fp = Paths.get("src/test/resources");
16+
String stringFromFile = StringifyFileContents.toString("a-text-file.txt", fp);
17+
assertEquals(stringFromFile, "The quick brown fox jumps over the lazy dog");
18+
}
2019

21-
@Test
22-
@Tag("unit")
23-
void testInvalidPath() {
24-
Path fp = Paths.get("src/test/reso");
25-
String stringFromFile = StringifyFileContents.toString("a-text-file.txt", fp);
26-
assertEquals(stringFromFile, "\nAn error reading file occured :c");
27-
}
20+
@Test
21+
@Tag("unit")
22+
void testInvalidPath() {
23+
Path fp = Paths.get("src/test/reso");
24+
String stringFromFile = StringifyFileContents.toString("a-text-file.txt", fp);
25+
assertEquals(stringFromFile, "\nAn error reading file occured :c");
26+
}
2827

29-
@Test
30-
@Tag("unit")
31-
void testInvalidFileName() {
32-
Path fp = Paths.get("src/test/resources");
33-
String stringFromFile = StringifyFileContents.toString("non-existent-text-file.txt", fp);
34-
assertEquals(stringFromFile, "\nAn error reading file occured :c");
35-
}
28+
@Test
29+
@Tag("unit")
30+
void testInvalidFileName() {
31+
Path fp = Paths.get("src/test/resources");
32+
String stringFromFile = StringifyFileContents.toString("non-existent-text-file.txt", fp);
33+
assertEquals(stringFromFile, "\nAn error reading file occured :c");
34+
}
3635
}
Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
11
package org.example;
22

3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
35
import org.json.JSONObject;
46
import org.junit.jupiter.api.Tag;
57
import org.junit.jupiter.api.Test;
68

7-
import static org.junit.jupiter.api.Assertions.assertEquals;
8-
99
public class TokensTest {
1010

11-
@Test
12-
@Tag("unit")
13-
void testValidJSON() {
14-
JSONObject meta = new JSONObject("{ `tokens`: { `input_tokens`: 69, `output_tokens`: 420 } }".replace('`', '"'));
15-
Tokens tokens = Tokens.fromJson(meta);
16-
assertEquals(tokens.getInputTokens(), 69);
17-
assertEquals(tokens.getOutputTokens(), 420);
18-
}
11+
@Test
12+
@Tag("unit")
13+
void testValidJSON() {
14+
JSONObject meta =
15+
new JSONObject(
16+
"{ `tokens`: { `input_tokens`: 69, `output_tokens`: 420 } }".replace('`', '"'));
17+
Tokens tokens = Tokens.fromJson(meta);
18+
assertEquals(tokens.getInputTokens(), 69);
19+
assertEquals(tokens.getOutputTokens(), 420);
20+
}
1921

20-
@Test
21-
@Tag("unit")
22-
void testJSONMissingTokens() {
23-
JSONObject meta = new JSONObject("{}");
24-
Tokens tokens = Tokens.fromJson(meta);
25-
assertEquals(tokens.getInputTokens(), 0);
26-
assertEquals(tokens.getOutputTokens(), 0);
27-
}
22+
@Test
23+
@Tag("unit")
24+
void testJSONMissingTokens() {
25+
JSONObject meta = new JSONObject("{}");
26+
Tokens tokens = Tokens.fromJson(meta);
27+
assertEquals(tokens.getInputTokens(), 0);
28+
assertEquals(tokens.getOutputTokens(), 0);
29+
}
2830

29-
@Test
30-
@Tag("unit")
31-
void testJSONMissingInputTokens() {
32-
JSONObject meta = new JSONObject("{ `tokens`: { `output_tokens`: 420 } }".replace('`', '"'));
33-
Tokens tokens = Tokens.fromJson(meta);
34-
assertEquals(tokens.getInputTokens(), 0);
35-
assertEquals(tokens.getOutputTokens(), 420);
36-
}
31+
@Test
32+
@Tag("unit")
33+
void testJSONMissingInputTokens() {
34+
JSONObject meta = new JSONObject("{ `tokens`: { `output_tokens`: 420 } }".replace('`', '"'));
35+
Tokens tokens = Tokens.fromJson(meta);
36+
assertEquals(tokens.getInputTokens(), 0);
37+
assertEquals(tokens.getOutputTokens(), 420);
38+
}
3739

38-
@Test
39-
@Tag("unit")
40-
void testJSONMissingOutputTokens() {
41-
JSONObject meta = new JSONObject("{ `tokens`: { `input_tokens`: 69 } }".replace('`', '"'));
42-
Tokens tokens = Tokens.fromJson(meta);
43-
assertEquals(tokens.getInputTokens(), 69);
44-
assertEquals(tokens.getOutputTokens(), 0);
45-
}
40+
@Test
41+
@Tag("unit")
42+
void testJSONMissingOutputTokens() {
43+
JSONObject meta = new JSONObject("{ `tokens`: { `input_tokens`: 69 } }".replace('`', '"'));
44+
Tokens tokens = Tokens.fromJson(meta);
45+
assertEquals(tokens.getInputTokens(), 69);
46+
assertEquals(tokens.getOutputTokens(), 0);
47+
}
4648
}

0 commit comments

Comments
 (0)