Stopped using getResource.

This commit is contained in:
Winston Li 2015-01-11 12:13:25 +00:00
parent 0dd12e5323
commit 517792517c
2 changed files with 9 additions and 10 deletions

View file

@ -2,6 +2,8 @@ package uk.ac.ic.wlgitbridge;
import uk.ac.ic.wlgitbridge.application.WLGitBridgeApplication;
import java.nio.file.Paths;
/**
* Created by Winston on 01/11/14.
*/

View file

@ -12,10 +12,7 @@ import uk.ac.ic.wlgitbridge.test.state.SnapshotAPIState;
import uk.ac.ic.wlgitbridge.test.state.SnapshotAPIStateBuilder;
import uk.ac.ic.wlgitbridge.test.util.FileUtil;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.*;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
@ -82,15 +79,15 @@ public class WLGitBridgeIntegrationTest {
}
private Path getResource(String path) {
return Paths.get("src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest" + path);
}
private InputStream getResourceAsStream(String path) {
try {
return Paths.get(getClass().getResource("/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest" + path).toURI());
} catch (URISyntaxException e) {
return new FileInputStream(getResource(path).toFile());
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
private InputStream getResourceAsStream(String path) {
return getClass().getResourceAsStream("/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest" + path);
}
}