From 68a6310a81779465d897e7572b9f3d4baa857611 Mon Sep 17 00:00:00 2001 From: Christopher Taylor Date: Wed, 9 Jul 2014 16:45:58 +0200 Subject: [PATCH] fix HttpParserTest initialization --- src/test/java/retromock/parser/HttpParserTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/test/java/retromock/parser/HttpParserTest.java b/src/test/java/retromock/parser/HttpParserTest.java index e7254b1..ce96842 100644 --- a/src/test/java/retromock/parser/HttpParserTest.java +++ b/src/test/java/retromock/parser/HttpParserTest.java @@ -1,6 +1,7 @@ package retromock.parser; import com.google.gson.Gson; +import org.junit.Before; import org.junit.Test; import retrofit.client.Header; import retrofit.client.Response; @@ -8,6 +9,7 @@ import retromock.test.FileLocator; import retromock.test.Http200ResponseBean; +import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; @@ -19,10 +21,15 @@ public class HttpParserTest { - static final List HTTP_FILES = FileLocator.findAllInClasspath("http-*-response.txt"); + private List HTTP_FILES; static final String LOCALHOST = "http://localhost"; static final Gson GSON = new Gson(); + @Before + public void setup() throws IOException { + HTTP_FILES = FileLocator.findAllInClasspath("http-*-response.txt"); + } + @Test public void testParse200ResponseFromFile() throws Exception { Response response = HttpParser.parse(LOCALHOST, getFile("http-200-response.txt")); @@ -78,7 +85,7 @@ private Map headerMap(List
headers) { return headerMap; } - private static Path getFile(String name) { + private Path getFile(String name) { Path fileName = Paths.get(name); for (Path path : HTTP_FILES) { if (path.endsWith(fileName)) {