Skip to content

Commit c86a89d

Browse files
author
Alex Soto
committed
Removes unncessary code.
1 parent ed5f746 commit c86a89d

File tree

1 file changed

+2
-33
lines changed

1 file changed

+2
-33
lines changed

src/test/java/com/github/fge/jsonpatch/diff/UnchangedTest.java

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,16 @@
1919

2020
package com.github.fge.jsonpatch.diff;
2121

22-
import com.fasterxml.jackson.core.JsonParser;
2322
import com.fasterxml.jackson.core.JsonPointer;
2423
import com.fasterxml.jackson.core.type.TypeReference;
2524
import com.fasterxml.jackson.databind.JsonNode;
2625
import com.fasterxml.jackson.databind.ObjectMapper;
27-
import com.fasterxml.jackson.databind.ObjectReader;
2826
import com.github.fge.jsonpatch.JacksonUtils;
27+
import com.github.fge.jsonpatch.ResourceUtil;
2928
import org.testng.annotations.DataProvider;
3029
import org.testng.annotations.Test;
3130

3231
import java.io.IOException;
33-
import java.io.InputStream;
34-
import java.net.URL;
3532
import java.util.ArrayList;
3633
import java.util.Iterator;
3734
import java.util.List;
@@ -53,7 +50,7 @@ public UnchangedTest()
5350
throws IOException
5451
{
5552
final String resource = "/jsonpatch/diff/unchanged.json";
56-
testData = fromResource(resource);
53+
testData = ResourceUtil.fromResource(resource);
5754
}
5855

5956
@DataProvider
@@ -78,32 +75,4 @@ public void computeUnchangedValuesWorks(final JsonNode first,
7875

7976
assertEquals(actual, expected);
8077
}
81-
82-
public static JsonNode fromResource(final String resource)
83-
throws IOException
84-
{
85-
URL url;
86-
url = UnchangedTest.class.getResource(resource);
87-
88-
if (url == null)
89-
throw new IOException("resource " + resource + " not found");
90-
91-
ObjectMapper mapper = JacksonUtils.newMapper();
92-
93-
ObjectReader reader = mapper.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, true)
94-
.reader(JsonNode.class);
95-
96-
InputStream is = null;
97-
JsonNode node = null;
98-
try {
99-
is = url.openStream();
100-
node = reader.readValue(is);
101-
} finally {
102-
if(is != null)
103-
{
104-
is.close();
105-
}
106-
}
107-
return node;
108-
}
10978
}

0 commit comments

Comments
 (0)