Skip to content

Commit

Permalink
fix HttpParserTest initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Taylor committed Jul 9, 2014
1 parent 607e164 commit 68a6310
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/test/java/retromock/parser/HttpParserTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package retromock.parser;

import com.google.gson.Gson;
import org.junit.Before;
import org.junit.Test;
import retrofit.client.Header;
import retrofit.client.Response;
import retrofit.mime.TypedByteArray;
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;
Expand All @@ -19,10 +21,15 @@

public class HttpParserTest {

static final List<Path> HTTP_FILES = FileLocator.findAllInClasspath("http-*-response.txt");
private List<Path> 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"));
Expand Down Expand Up @@ -78,7 +85,7 @@ private Map<String, String> headerMap(List<Header> 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)) {
Expand Down

0 comments on commit 68a6310

Please sign in to comment.