Skip to content

Commit be0aaeb

Browse files
committed
refactor: satisfy linter warnings
1 parent 8322b18 commit be0aaeb

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/test/java/edu/kit/datamanager/ro_crate/context/ContextTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package edu.kit.datamanager.ro_crate.context;
22

3-
import com.fasterxml.jackson.core.JsonProcessingException;
43
import com.fasterxml.jackson.databind.JsonNode;
54
import com.fasterxml.jackson.databind.ObjectMapper;
65
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -32,7 +31,6 @@ void initContext() throws IOException {
3231
this.context = new RoCrateMetadataContext();
3332

3433
final String crateManifestPath = "/crates/extendedContextExample/ro-crate-metadata.json";
35-
ContextTest.class.getResource(crateManifestPath).getPath();
3634
ObjectMapper objectMapper = MyObjectMapper.getMapper();
3735
JsonNode jsonNode = objectMapper.readTree(ContextTest.class.getResourceAsStream(crateManifestPath));
3836
this.complexContext = new RoCrateMetadataContext(jsonNode.get("@context"));
@@ -147,7 +145,7 @@ void deleteUrlTest() {
147145
}
148146

149147
@Test
150-
void doubledContextUrlsTest() throws JsonProcessingException {
148+
void doubledContextUrlsTest() {
151149
String url = "www.example.com";
152150
RoCrateMetadataContext context = new RoCrateMetadataContext();
153151
assertFalse(context.urls.contains(url));
@@ -246,7 +244,7 @@ void testSetDeleteGetPair() {
246244
}
247245

248246
@Test
249-
void testReadDeleteGetPair() throws IOException {
247+
void testReadDeleteGetPair() {
250248
String key = "custom";
251249
String value = "_:";
252250
assertEquals(value, this.complexContext.readValueOf(key));
@@ -257,7 +255,7 @@ void testReadDeleteGetPair() throws IOException {
257255
}
258256

259257
@Test
260-
void testReadKeys() throws IOException {
258+
void testReadKeys() {
261259
var expected = Set.of("custom", "owl", "datacite", "xsd", "rdfs");
262260
var given = this.complexContext.readKeys();
263261
for (String key : expected) {
@@ -266,7 +264,7 @@ void testReadKeys() throws IOException {
266264
}
267265

268266
@Test
269-
void testReadPairs() throws IOException {
267+
void testReadPairs() {
270268
var expected = Set.of("custom", "owl", "datacite", "xsd", "rdfs");
271269
var given = this.complexContext.readPairs();
272270
var keys = given.keySet();

src/test/java/edu/kit/datamanager/ro_crate/crate/TestRemoveAddContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import com.fasterxml.jackson.core.JsonProcessingException;
99

10+
import java.util.Objects;
1011
import java.util.Set;
1112

1213
import org.junit.jupiter.api.BeforeEach;
@@ -19,7 +20,7 @@ public class TestRemoveAddContext {
1920
@BeforeEach
2021
void setup() {
2122
String crateManifestPath = "/crates/extendedContextExample/";
22-
crateManifestPath = TestRemoveAddContext.class.getResource(crateManifestPath).getPath();
23+
crateManifestPath = Objects.requireNonNull(TestRemoveAddContext.class.getResource(crateManifestPath)).getPath();
2324
this.crateWithComplexContext = new RoCrateReader(new FolderReader()).readCrate(crateManifestPath);
2425
}
2526

0 commit comments

Comments
 (0)