// Path: MarvelApiClient/src/test/java/com/karumi/marvelapiclient/extensions/FileExtensions.java
// public final class FileExtensions {
// 
//   private static final String UTF_8 = "UTF-8";
// 
//   private FileExtensions() {
//   }
// 
//   public static String getStringFromFile(Class clazz, String filePath) throws IOException {
//     ClassLoader classLoader = clazz.getClassLoader();
//     File file = new File(classLoader.getResource("resources/" + filePath).getFile());
//     return FileUtils.readFileToString(file, UTF_8);
//   }
// }
// 
// Path: MarvelApiClient/src/main/java/com/karumi/marvelapiclient/model/MarvelResponse.java
// public class MarvelResponse<T> {
//   @SerializedName("code") private int code;
//   @SerializedName("status") private String status;
//   @SerializedName("copyright") private String copyright;
//   @SerializedName("attributionText") private String attributionText;
//   @SerializedName("attributionHTML") private String getAttributionHtml;
//   @SerializedName("etag") private String etag;
// 
//   @SerializedName("data") private T response;
// 
//   public MarvelResponse() {
//   }
// 
//   public MarvelResponse(MarvelResponse marvelResponse) {
//     code = marvelResponse.getCode();
//     status = marvelResponse.getStatus();
//     copyright = marvelResponse.getCopyright();
//     attributionText = marvelResponse.getAttributionText();
//     getAttributionHtml = marvelResponse.getGetAttributionHtml();
//     etag = marvelResponse.getEtag();
//   }
// 
//   public int getCode() {
//     return code;
//   }
// 
//   public String getStatus() {
//     return status;
//   }
// 
//   public String getCopyright() {
//     return copyright;
//   }
// 
//   public String getAttributionText() {
//     return attributionText;
//   }
// 
//   public String getGetAttributionHtml() {
//     return getAttributionHtml;
//   }
// 
//   public T getResponse() {
//     return response;
//   }
// 
//   public String getEtag() {
//     return etag;
//   }
// 
//   @Override public String toString() {
//     return "MarvelResponse{"
//            + "code="
//            + code
//            + ", status='"
//            + status
//            + '\''
//            + ", copyright='"
//            + copyright
//            + '\''
//            + ", attributionText='"
//            + attributionText
//            + '\''
//            + ", getAttributionHtml='"
//            + getAttributionHtml
//            + '\''
//            + ", etag='"
//            + etag
//            + '\''
//            + ", response="
//            + response
//            + '}';
//   }
// 
//   public void setResponse(T response) {
//     this.response = response;
//   }
// }


import com.karumi.marvelapiclient.extensions.FileExtensions;
import com.karumi.marvelapiclient.model.MarvelResponse;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import com.squareup.okhttp.mockwebserver.RecordedRequest;
import java.io.IOException;
import org.hamcrest.core.StringContains;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.mockito.MockitoAnnotations;
import static org.junit.Assert.assertEquals;
/*
 *   Copyright (C) 2015 Karumi.
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package com.karumi.marvelapiclient;



public class ApiClientTest {
  protected static final String ANY_TIME_ZONE = "PST";
  private static final int OK_CODE = 200;

  private MockWebServer server;

  @Before public void setUp() throws Exception {
    System.setProperty("user.timezone", ANY_TIME_ZONE);
    MockitoAnnotations.initMocks(this);
    this.server = new MockWebServer();
    this.server.start();
  }

  @After public void tearDown() throws Exception {
    server.shutdown();
  }

  protected void enqueueMockResponse() throws IOException {
    enqueueMockResponse(OK_CODE);
  }

  protected void enqueueMockResponse(int code) throws IOException {
    enqueueMockResponse(code, "{}");
  }

  protected void enqueueMockResponse(int code, String response) throws IOException {
    MockResponse mockResponse = new MockResponse();
    mockResponse.setResponseCode(code);
    mockResponse.setBody(response);
    server.enqueue(mockResponse);
  }

  protected void enqueueMockResponse(String fileName) throws IOException {
// Path: MarvelApiClient/src/test/java/com/karumi/marvelapiclient/extensions/FileExtensions.java
// public final class FileExtensions {
// 
//   private static final String UTF_8 = "UTF-8";
// 
//   private FileExtensions() {
//   }
// 
//   public static String getStringFromFile(Class clazz, String filePath) throws IOException {
//     ClassLoader classLoader = clazz.getClassLoader();
//     File file = new File(classLoader.getResource("resources/" + filePath).getFile());
//     return FileUtils.readFileToString(file, UTF_8);
//   }
// }
// 
// Path: MarvelApiClient/src/main/java/com/karumi/marvelapiclient/model/MarvelResponse.java
// public class MarvelResponse<T> {
//   @SerializedName("code") private int code;
//   @SerializedName("status") private String status;
//   @SerializedName("copyright") private String copyright;
//   @SerializedName("attributionText") private String attributionText;
//   @SerializedName("attributionHTML") private String getAttributionHtml;
//   @SerializedName("etag") private String etag;
// 
//   @SerializedName("data") private T response;
// 
//   public MarvelResponse() {
//   }
// 
//   public MarvelResponse(MarvelResponse marvelResponse) {
//     code = marvelResponse.getCode();
//     status = marvelResponse.getStatus();
//     copyright = marvelResponse.getCopyright();
//     attributionText = marvelResponse.getAttributionText();
//     getAttributionHtml = marvelResponse.getGetAttributionHtml();
//     etag = marvelResponse.getEtag();
//   }
// 
//   public int getCode() {
//     return code;
//   }
// 
//   public String getStatus() {
//     return status;
//   }
// 
//   public String getCopyright() {
//     return copyright;
//   }
// 
//   public String getAttributionText() {
//     return attributionText;
//   }
// 
//   public String getGetAttributionHtml() {
//     return getAttributionHtml;
//   }
// 
//   public T getResponse() {
//     return response;
//   }
// 
//   public String getEtag() {
//     return etag;
//   }
// 
//   @Override public String toString() {
//     return "MarvelResponse{"
//            + "code="
//            + code
//            + ", status='"
//            + status
//            + '\''
//            + ", copyright='"
//            + copyright
//            + '\''
//            + ", attributionText='"
//            + attributionText
//            + '\''
//            + ", getAttributionHtml='"
//            + getAttributionHtml
//            + '\''
//            + ", etag='"
//            + etag
//            + '\''
//            + ", response="
//            + response
//            + '}';
//   }
// 
//   public void setResponse(T response) {
//     this.response = response;
//   }
// }


// Path: MarvelApiClient/src/test/java/com/karumi/marvelapiclient/ApiClientTest.java
import com.karumi.marvelapiclient.extensions.FileExtensions;
import com.karumi.marvelapiclient.model.MarvelResponse;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import com.squareup.okhttp.mockwebserver.RecordedRequest;
import java.io.IOException;
import org.hamcrest.core.StringContains;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.mockito.MockitoAnnotations;
import static org.junit.Assert.assertEquals;

/*
 *   Copyright (C) 2015 Karumi.
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package com.karumi.marvelapiclient;



public class ApiClientTest {
  protected static final String ANY_TIME_ZONE = "PST";
  private static final int OK_CODE = 200;

  private MockWebServer server;

  @Before public void setUp() throws Exception {
    System.setProperty("user.timezone", ANY_TIME_ZONE);
    MockitoAnnotations.initMocks(this);
    this.server = new MockWebServer();
    this.server.start();
  }

  @After public void tearDown() throws Exception {
    server.shutdown();
  }

  protected void enqueueMockResponse() throws IOException {
    enqueueMockResponse(OK_CODE);
  }

  protected void enqueueMockResponse(int code) throws IOException {
    enqueueMockResponse(code, "{}");
  }

  protected void enqueueMockResponse(int code, String response) throws IOException {
    MockResponse mockResponse = new MockResponse();
    mockResponse.setResponseCode(code);
    mockResponse.setBody(response);
    server.enqueue(mockResponse);
  }

  protected void enqueueMockResponse(String fileName) throws IOException {
    String body = FileExtensions.getStringFromFile(getClass(), fileName);