Skip to content

Commit 1c666a7

Browse files
committed
Moved the test files for the ResettableFileInputStream_Test into the resources folder. Also updated the build file so that the tests are ran before install is invoked.
1 parent 8a7ac70 commit 1c666a7

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jar.archiveName = 'ds3_java_sdk'
2222
version = '0.2.5-SNAPSHOT'
2323
group = 'com.spectralogic'
2424

25+
install.dependsOn test //make sure that the tests get ran before attempting to install
26+
2527
repositories {
2628
mavenCentral()
2729
mavenLocal()

src/test/java/com/spectralogic/ds3client/helpers/ResettableFileInputStream_Test.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,14 @@
2929
public class ResettableFileInputStream_Test {
3030
@Test
3131
public void testReset() throws IOException {
32-
final byte[] expectedBytes = Files.readAllBytes(Paths.get(this.resource("LoremIpsumTwice.testdata")));
32+
final byte[] expectedBytes = Files.readAllBytes(Paths.get("src/test/resources/LoremIpsumTwice.testdata"));
3333
try (final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(expectedBytes.length)) {
34-
try (final InputStream inputStream = new ResettableFileInputStream(new FileInputStream(this.resource("LoremIpsum.testdata")))) {
34+
try (final InputStream inputStream = new ResettableFileInputStream(new FileInputStream("src/test/resources/LoremIpsum.testdata"))) {
3535
IOUtils.copy(inputStream, byteArrayOutputStream);
3636
inputStream.reset();
3737
IOUtils.copy(inputStream, byteArrayOutputStream);
3838
}
3939
Assert.assertArrayEquals(expectedBytes, byteArrayOutputStream.toByteArray());
4040
}
4141
}
42-
43-
private String resource(final String name) {
44-
return this.getClass().getResource(name).getFile();
45-
}
4642
}

0 commit comments

Comments
 (0)