From 24584cc1b2c8ae5fd0dbe0f044b1f57ecb27e06f Mon Sep 17 00:00:00 2001 From: Katsute <58778985+Katsute@users.noreply.github.com> Date: Wed, 14 Oct 2020 17:07:16 -0400 Subject: [PATCH 1/3] replace core with junit --- pom.xml | 14 ----- .../handlers/file/FileHandlerAddDirTest.java | 57 +++++++++++-------- .../file/FileHandlerAddFilesTest.java | 21 ++++--- .../handlers/file/FileHandlerAddTest.java | 25 ++++---- .../handlers/file/FileHandlerNoWalkTest.java | 57 +++++++++++-------- .../handlers/file/FileHandlerWalkTest.java | 44 ++++++++------ 6 files changed, 119 insertions(+), 99 deletions(-) diff --git a/pom.xml b/pom.xml index c6a3853..e161bbe 100644 --- a/pom.xml +++ b/pom.xml @@ -158,22 +158,8 @@ - - - jitpack.io - https://jitpack.io - - - - - com.kttdevelopment.core - test-util - main-SNAPSHOT - test - - junit junit diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddDirTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddDirTest.java index 2bcfa5f..e7b6205 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddDirTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddDirTest.java @@ -1,19 +1,22 @@ package com.kttdevelopment.simplehttpserver.handlers.file; -import com.kttdevelopment.core.tests.TestUtil; import com.kttdevelopment.simplehttpserver.SimpleHttpServer; import com.kttdevelopment.simplehttpserver.handler.FileHandler; -import org.junit.Assert; -import org.junit.Test; +import org.junit.*; +import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; import java.net.URI; import java.net.http.*; +import java.nio.file.Files; import java.util.concurrent.ExecutionException; public final class FileHandlerAddDirTest { + @Rule + public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + @SuppressWarnings("SpellCheckingInspection") @Test public final void addDirectoryTestsNoWalk() throws IOException, InterruptedException{ @@ -24,30 +27,32 @@ public final void addDirectoryTestsNoWalk() throws IOException, InterruptedExcep final String contextWName = "altn"; final String dirNewName = "dirName"; - final String testRealFile = "test.txt", testFileContent = "readme"; - final String noReadDir = "dirnoread"; - final String noReadFile = "innerNoRead.txt"; + final String fileName = "file"; + final String testContent = String.valueOf(System.currentTimeMillis()); - final File noWalk = new File("src/test/resources/directory/nowalk"); + final File dir = directory.getRoot(); + final File subdir = directory.newFolder(); - TestUtil.createTestFile(new File(noWalk,testRealFile),testFileContent); - TestUtil.createTestFile(new File(new File(noWalk,noReadDir),noReadFile),testFileContent); + final File file = new File(directory.getRoot(),fileName); + Files.write(file.toPath(),testContent.getBytes()); + final File walk = new File(subdir,fileName); + Files.write(walk.toPath(),testContent.getBytes()); final String context = ""; - handler.addDirectory(noWalk); // test file & directory read - handler.addDirectory(contextNoName,noWalk); - handler.addDirectory(noWalk,dirNewName); - handler.addDirectory(contextWName,noWalk,dirNewName); + handler.addDirectory(dir); // test file & directory read + handler.addDirectory(contextNoName,dir); + handler.addDirectory(dir,dirNewName); + handler.addDirectory(contextWName,dir,dirNewName); server.createContext(context,handler); server.start(); final String[] validPathsToTest = { // valid reads - noWalk.getName() + '/' + testRealFile, - contextNoName + '/' + noWalk.getName() + '/' + testRealFile, - dirNewName + '/' + testRealFile, - contextWName + '/' + dirNewName + '/' + testRealFile + dir.getName() + '/' + "file", + contextNoName + '/' + dir.getName() + '/' + fileName, + dirNewName + '/' + fileName, + contextWName + '/' + dirNewName + '/' + fileName }; for(final String path : validPathsToTest){ @@ -57,19 +62,21 @@ public final void addDirectoryTestsNoWalk() throws IOException, InterruptedExcep .build(); try{ - final String response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) - .thenApply(HttpResponse::body).get(); + final String response = HttpClient.newHttpClient() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()) + .thenApply(HttpResponse::body) + .get(); Assert.assertNotNull("Client did not find data for " + path, response); - Assert.assertEquals("Client data did not match server data for " + path,testFileContent,response); + Assert.assertEquals("Client data did not match server data for " + path,testContent,response); }catch(final ExecutionException ignored){ Assert.fail("Client did not find data for " + path); } } final String[] invalidPathsToTest = { - noWalk.getName() + '/' + noReadDir, - noWalk.getName() + '/' + noReadDir + '/' + noReadFile + dir.getName() + '/' + subdir.getName(), + dir.getName() + '/' + subdir.getName() + '/' + fileName }; for(final String path : invalidPathsToTest){ @@ -80,8 +87,10 @@ public final void addDirectoryTestsNoWalk() throws IOException, InterruptedExcep Exception exception = null; try{ - final String response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) - .thenApply(HttpResponse::body).get(); + final String response = HttpClient.newHttpClient() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()) + .thenApply(HttpResponse::body) + .get(); Assert.assertNull("Client found data for blocked path " + path,response); }catch(final ExecutionException e){ diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddFilesTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddFilesTest.java index d6f05f4..86c5597 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddFilesTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddFilesTest.java @@ -1,11 +1,10 @@ package com.kttdevelopment.simplehttpserver.handlers.file; -import com.kttdevelopment.core.tests.TestUtil; import com.kttdevelopment.simplehttpserver.SimpleHttpServer; import com.kttdevelopment.simplehttpserver.handler.FileHandler; import com.kttdevelopment.simplehttpserver.handler.FileHandlerAdapter; -import org.junit.Assert; -import org.junit.Test; +import org.junit.*; +import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; @@ -15,6 +14,10 @@ public final class FileHandlerAddFilesTest { + @Rule + public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + + @Test public final void addFilesTests() throws IOException, ExecutionException, InterruptedException{ final int port = 8080; @@ -35,13 +38,10 @@ public final String getName(final File file){ final FileHandler handler = new FileHandler(adapter); final File[] files = new File[]{ - new File("src/test/resources/files/test.txt"), - new File("src/test/resources/files/test2.txt") + directory.newFile(), + directory.newFile() }; - for(final File file : files) - TestUtil.createTestFile(file); - handler.addFiles(files); handler.addFiles(altContext,files); @@ -52,7 +52,7 @@ public final String getName(final File file){ for(final File file : files){ final String url = "http://localhost:" + port + context; HttpRequest request = HttpRequest.newBuilder() - .uri(URI.create(url + "/" + file.getName().substring(0, file.getName().lastIndexOf('.')))) + .uri(URI.create(url + '/' + file.getName().substring(0, file.getName().lastIndexOf('.')))) .build(); String response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) @@ -64,7 +64,7 @@ public final String getName(final File file){ final String altUrl = "http://localhost:" + port + altContext; request = HttpRequest.newBuilder() - .uri(URI.create(altUrl + "/" + file.getName().substring(0,file.getName().lastIndexOf('.')))) + .uri(URI.create(altUrl + '/' + file.getName().substring(0,file.getName().lastIndexOf('.')))) .build(); response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) @@ -74,7 +74,6 @@ public final String getName(final File file){ } server.stop(); - } } diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java index f674847..793753f 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java @@ -4,8 +4,8 @@ import com.kttdevelopment.simplehttpserver.SimpleHttpServer; import com.kttdevelopment.simplehttpserver.handler.ByteLoadingOption; import com.kttdevelopment.simplehttpserver.handler.FileHandler; -import org.junit.Assert; -import org.junit.Test; +import org.junit.*; +import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; @@ -18,6 +18,9 @@ public final class FileHandlerAddTest { + @Rule + public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + @SuppressWarnings("SpellCheckingInspection") @Test public final void addFileTests() throws IOException{ @@ -26,17 +29,19 @@ public final void addFileTests() throws IOException{ final FileHandler handler = new FileHandler(); final String context = ""; - final File dir = new File("src/test/resources/file"); - final Map files = new HashMap<>(); for(final ByteLoadingOption blop : ByteLoadingOption.values()) - files.put(new File(dir, blop.name() + ".txt"),blop); + files.put(directory.newFile(blop.name()),blop); // initial write - final String init = String.valueOf(System.currentTimeMillis()); + final String testContent = String.valueOf(System.currentTimeMillis()); files.forEach((file, loadingOption) -> { - TestUtil.createTestFile(file,init); - handler.addFile(file, loadingOption); + try{ + Files.write(file.toPath(),testContent.getBytes()); + handler.addFile(file, loadingOption); + }catch(final IOException e){ + e.printStackTrace(); + } }); server.createContext(context,handler); @@ -51,7 +56,7 @@ public final void addFileTests() throws IOException{ try{ final String response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) .thenApply(HttpResponse::body).get(); - Assert.assertEquals("Client data did not match server data for " + file.getName(),init,response); + Assert.assertEquals("Client data did not match server data for " + file.getName(),testContent,response); }catch(final InterruptedException | ExecutionException ignored){ Assert.fail("Failed to read context of " + file.getName()); } @@ -69,7 +74,7 @@ public final void addFileTests() throws IOException{ final String response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) .thenApply(HttpResponse::body).get(); - Assert.assertEquals("Client data did not match server data for " + file.getName(),loadingOption == ByteLoadingOption.PRELOAD ? init : after,response); + Assert.assertEquals("Client data did not match server data for " + file.getName(),loadingOption == ByteLoadingOption.PRELOAD ? testContent : after,response); }catch(final InterruptedException | ExecutionException ignored){ Assert.fail("Failed to read context " + file.getName()); } diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java index e367920..686b85a 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java @@ -4,17 +4,21 @@ import com.kttdevelopment.simplehttpserver.SimpleHttpServer; import com.kttdevelopment.simplehttpserver.handler.FileHandler; import com.kttdevelopment.simplehttpserver.handler.FileHandlerAdapter; -import org.junit.Assert; -import org.junit.Test; +import org.junit.*; +import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; import java.net.URI; import java.net.http.*; +import java.nio.file.Files; import java.util.concurrent.ExecutionException; public final class FileHandlerNoWalkTest { + @Rule + public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + @SuppressWarnings("SpellCheckingInspection") @Test public final void addDirectoryTestsNoWalkAdapter() throws IOException, InterruptedException{ @@ -36,30 +40,33 @@ public final String getName(final File file){ final String contextWName = "altn"; final String dirNewName = "dirName"; - final String testRealFile = "test", testFileContent = "readme"; - final String noReadDir = "dirnoread"; - final String noReadFile = "innerNoRead"; + final String fileName = "file.txt"; + final String expectedName = "file"; + final String testContent = String.valueOf(System.currentTimeMillis()); - final File noWalk = new File("src/test/resources/directory/nowalk"); + final File dir = directory.getRoot(); + final File subdir = directory.newFolder(); - TestUtil.createTestFile(new File(noWalk, testRealFile + ".txt"), testFileContent); - TestUtil.createTestFile(new File(new File(noWalk,noReadDir),noReadFile + ".txt"),testFileContent); + final File file = new File(directory.getRoot(),fileName); + Files.write(file.toPath(), testContent.getBytes()); + final File walk = new File(subdir,fileName); + Files.write(walk.toPath(),testContent.getBytes()); final String context = ""; - handler.addDirectory(noWalk); // test file & directory read - handler.addDirectory(contextNoName,noWalk); - handler.addDirectory(noWalk,dirNewName); - handler.addDirectory(contextWName,noWalk,dirNewName); + handler.addDirectory(dir); // test file & directory read + handler.addDirectory(contextNoName,dir); + handler.addDirectory(dir,dirNewName); + handler.addDirectory(contextWName,dir,dirNewName); server.createContext(context,handler); server.start(); final String[] validPathsToTest = { // valid reads - noWalk.getName() + '/' + testRealFile, - contextNoName + '/' + noWalk.getName() + '/' + testRealFile, - dirNewName + '/' + testRealFile, - contextWName + '/' + dirNewName + '/' + testRealFile + dir.getName() + '/' + expectedName, + contextNoName + '/' + dir.getName() + '/' + expectedName, + dirNewName + '/' + expectedName, + contextWName + '/' + dirNewName + '/' + expectedName }; for(final String path : validPathsToTest){ @@ -69,19 +76,21 @@ public final String getName(final File file){ .build(); try{ - final String response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) - .thenApply(HttpResponse::body).get(); + final String response = HttpClient.newHttpClient() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()) + .thenApply(HttpResponse::body) + .get(); Assert.assertNotNull("Client did not find data for " + path, response); - Assert.assertEquals("Client data did not match server data for " + path,testFileContent,response); + Assert.assertEquals("Client data did not match server data for " + path,testContent,response); }catch(final ExecutionException ignored){ Assert.fail("Client did not find data for " + path); } } final String[] invalidPathsToTest = { - noWalk.getName() + '/' + noReadDir, - noWalk.getName() + '/' + noReadDir + '/' + noReadFile + dir.getName() + '/' + subdir.getName(), + dir.getName() + '/' + subdir.getName() + '/' + fileName }; for(final String path : invalidPathsToTest){ @@ -92,8 +101,10 @@ public final String getName(final File file){ Exception exception = null; try{ - final String response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) - .thenApply(HttpResponse::body).get(); + final String response = HttpClient.newHttpClient() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()) + .thenApply(HttpResponse::body) + .get(); Assert.assertNull("Client found data for blocked path " + path,response); }catch(final ExecutionException e){ diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java index b8bceab..2f2bdfa 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java @@ -3,43 +3,49 @@ import com.kttdevelopment.core.tests.TestUtil; import com.kttdevelopment.simplehttpserver.SimpleHttpServer; import com.kttdevelopment.simplehttpserver.handler.FileHandler; -import org.junit.Assert; -import org.junit.Test; +import org.junit.*; +import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; import java.net.URI; import java.net.http.*; +import java.nio.file.Files; import java.util.concurrent.ExecutionException; @SuppressWarnings("SpellCheckingInspection") public final class FileHandlerWalkTest { + @Rule + public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + @Test public final void addDirectoryTestsWalk() throws IOException, InterruptedException{ final int port = 8080; final SimpleHttpServer server = SimpleHttpServer.create(port); final FileHandler handler = new FileHandler(); - final String testRealFile = "test.txt", testFileContent = "readme"; - final String readDir = "dirnoread"; - final String innerFile = "innerNoRead.txt"; + final String fileName = "file"; + final String testContent = String.valueOf(System.currentTimeMillis()); - final File noWalk = new File("src/test/resources/directory/nowalk"); + final File dir = directory.getRoot(); + final File subdir = directory.newFolder(); - TestUtil.createTestFile(new File(noWalk, testRealFile), testFileContent); - TestUtil.createTestFile(new File(new File(noWalk,readDir),innerFile),testFileContent); + final File file = new File(directory.getRoot(),fileName); + Files.write(file.toPath(), testContent.getBytes()); + final File walk = new File(subdir,fileName); + Files.write(walk.toPath(),testContent.getBytes()); final String context = ""; - handler.addDirectory(noWalk,true); + handler.addDirectory(dir,true); server.createContext(context,handler); server.start(); final String[] validPathsToTest = { // valid reads - noWalk.getName() + '/' + testRealFile, - noWalk.getName() + '/' + readDir + '/' + innerFile + dir.getName() + '/' + file.getName(), + dir.getName() + '/' + subdir.getName() + '/' + walk.getName() }; for(final String path : validPathsToTest){ @@ -49,18 +55,20 @@ public final void addDirectoryTestsWalk() throws IOException, InterruptedExcepti .build(); try{ - final String response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) - .thenApply(HttpResponse::body).get(); + final String response = HttpClient.newHttpClient() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()) + .thenApply(HttpResponse::body) + .get(); Assert.assertNotNull("Client did not find data for " + path,response); - Assert.assertEquals("Client data did not match server data for " + path,testFileContent,response); + Assert.assertEquals("Client data did not match server data for " + path,testContent,response); }catch(final ExecutionException ignored){ Assert.fail("Client did not find data for " + path); } } final String[] invalidPathsToTest = { - noWalk.getName() + '/' + readDir + dir.getName() + '/' + subdir.getName() }; for(final String path : invalidPathsToTest){ @@ -71,8 +79,10 @@ public final void addDirectoryTestsWalk() throws IOException, InterruptedExcepti Exception exception = null; try{ - String response = HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString()) - .thenApply(HttpResponse::body).get(); + final String response = HttpClient.newHttpClient() + .sendAsync(request, HttpResponse.BodyHandlers.ofString()) + .thenApply(HttpResponse::body) + .get(); Assert.assertNull("Client found data for blocked path " + path,response); }catch(final ExecutionException e){ From 720f27e4cf4e392dabad49ea3dc1a72ed8edf7a3 Mon Sep 17 00:00:00 2001 From: Katsute <58778985+Katsute@users.noreply.github.com> Date: Wed, 14 Oct 2020 17:11:42 -0400 Subject: [PATCH 2/3] fix faulty import --- .../simplehttpserver/handlers/file/FileHandlerAddTest.java | 1 - .../simplehttpserver/handlers/file/FileHandlerNoWalkTest.java | 1 - .../simplehttpserver/handlers/file/FileHandlerWalkTest.java | 1 - 3 files changed, 3 deletions(-) diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java index 793753f..f9db64a 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java @@ -1,6 +1,5 @@ package com.kttdevelopment.simplehttpserver.handlers.file; -import com.kttdevelopment.core.tests.TestUtil; import com.kttdevelopment.simplehttpserver.SimpleHttpServer; import com.kttdevelopment.simplehttpserver.handler.ByteLoadingOption; import com.kttdevelopment.simplehttpserver.handler.FileHandler; diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java index 686b85a..607ce46 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java @@ -1,6 +1,5 @@ package com.kttdevelopment.simplehttpserver.handlers.file; -import com.kttdevelopment.core.tests.TestUtil; import com.kttdevelopment.simplehttpserver.SimpleHttpServer; import com.kttdevelopment.simplehttpserver.handler.FileHandler; import com.kttdevelopment.simplehttpserver.handler.FileHandlerAdapter; diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java index 2f2bdfa..be85f85 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java @@ -1,6 +1,5 @@ package com.kttdevelopment.simplehttpserver.handlers.file; -import com.kttdevelopment.core.tests.TestUtil; import com.kttdevelopment.simplehttpserver.SimpleHttpServer; import com.kttdevelopment.simplehttpserver.handler.FileHandler; import org.junit.*; From ca43745f13db5976ed00d9f920a0dfa891731e52 Mon Sep 17 00:00:00 2001 From: Katsute <58778985+Katsute@users.noreply.github.com> Date: Wed, 14 Oct 2020 17:16:14 -0400 Subject: [PATCH 3/3] Fix missing directory --- .../simplehttpserver/handlers/file/FileHandlerAddDirTest.java | 2 +- .../simplehttpserver/handlers/file/FileHandlerAddFilesTest.java | 2 +- .../simplehttpserver/handlers/file/FileHandlerAddTest.java | 2 +- .../simplehttpserver/handlers/file/FileHandlerNoWalkTest.java | 2 +- .../simplehttpserver/handlers/file/FileHandlerWalkTest.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddDirTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddDirTest.java index e7b6205..864ec44 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddDirTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddDirTest.java @@ -15,7 +15,7 @@ public final class FileHandlerAddDirTest { @Rule - public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + public final TemporaryFolder directory = new TemporaryFolder(new File(".")); @SuppressWarnings("SpellCheckingInspection") @Test diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddFilesTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddFilesTest.java index 86c5597..fc37f43 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddFilesTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddFilesTest.java @@ -15,7 +15,7 @@ public final class FileHandlerAddFilesTest { @Rule - public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + public final TemporaryFolder directory = new TemporaryFolder(new File(".")); @Test diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java index f9db64a..26e5e55 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerAddTest.java @@ -18,7 +18,7 @@ public final class FileHandlerAddTest { @Rule - public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + public final TemporaryFolder directory = new TemporaryFolder(new File(".")); @SuppressWarnings("SpellCheckingInspection") @Test diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java index 607ce46..8beef2a 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerNoWalkTest.java @@ -16,7 +16,7 @@ public final class FileHandlerNoWalkTest { @Rule - public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + public final TemporaryFolder directory = new TemporaryFolder(new File(".")); @SuppressWarnings("SpellCheckingInspection") @Test diff --git a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java index be85f85..0f3e54a 100644 --- a/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java +++ b/src/test/java/com/kttdevelopment/simplehttpserver/handlers/file/FileHandlerWalkTest.java @@ -16,7 +16,7 @@ public final class FileHandlerWalkTest { @Rule - public final TemporaryFolder directory = new TemporaryFolder(new File("src/test/resources")); + public final TemporaryFolder directory = new TemporaryFolder(new File(".")); @Test public final void addDirectoryTestsWalk() throws IOException, InterruptedException{