// Path: linkshortener-api/src/main/java/be/drissamri/config/safebrowsing/phishtank/PhishTankConfig.java
// @Component
// @Conditional(PhishTankCondition.class)
// public class PhishTankConfig {
//   private static final Logger LOGGER = LoggerFactory.getLogger(PhishTankConfig.class);
//   private static final String PARAMETER_API_KEY = "app_key";
//   private static final String PARAMETER_FORMAT = "format";
//   private static final String RESPONSE_FORMAT = "json";
//   private final String apiUrl;
//   private final MultiValueMap<String, String> parameters;
// 
//   @Autowired
//   public PhishTankConfig(PhishTankSettings settings) {
//     this.apiUrl = settings.getEndpoint();
//     this.parameters = new LinkedMultiValueMap<>();
//     parameters.add(PARAMETER_API_KEY, settings.getCredential());
//     parameters.add(PARAMETER_FORMAT, RESPONSE_FORMAT);
// 
//     if (!StringUtils.isEmpty(parameters.getFirst(PARAMETER_API_KEY))
//       && !StringUtils.isEmpty(parameters.get(PARAMETER_FORMAT))) {
//       LOGGER.info("PhishTank API is configured with an API key");
//     }
//   }
// 
//   public final String getApiUrl() {
//     return apiUrl;
//   }
// 
//   public final MultiValueMap<String, String> getParameters() {
//     return new LinkedMultiValueMap<>(parameters);
//   }
// }
// 
// Path: linkshortener-api/src/main/java/be/drissamri/config/safebrowsing/phishtank/PhishTankSettings.java
// @Component
// @Conditional(PhishTankCondition.class)
// public class PhishTankSettings implements ApiSettings {
//   private final String endpoint;
//   private final String credential;
// 
//   @Autowired
//   public PhishTankSettings(
//     @Value("${provider.phishtank.url}") final String endpoint,
//     @Value("${provider.phishtank.key}") final String credential) {
//     this.endpoint = endpoint;
//     this.credential = credential;
//   }
// 
//   @Override
//   public final String getEndpoint() {
//     return this.endpoint;
//   }
// 
//   @Override
//   public final String getCredential() {
//     return this.credential;
//   }
// 
//   @Override
//   public final String getVersion() {
//     return "v1";
//   }
// }


import be.drissamri.config.safebrowsing.phishtank.PhishTankConfig;
import be.drissamri.config.safebrowsing.phishtank.PhishTankSettings;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.*;
package be.drissamri.service.verifier;



public class PhishTankUrlVerifierTest {
  private PhishTankUrlVerifier phishTankUrlVerifier;
  @Mock
  private RestTemplate restTemplate;
  private static final String LONG_URL = "http://www.drissamri.be";
  private static final String JSON_PHISH_RESULT = "{ 'results': { 'in_database': true } }";
  private static final String JSON_SAFE_RESULT = "{ 'results': { 'in_database': false } }";
  private static final String JSON_UNKOWN_RESULT = "{ }";

  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    phishTankUrlVerifier = new PhishTankUrlVerifier(
        restTemplate,
// Path: linkshortener-api/src/main/java/be/drissamri/config/safebrowsing/phishtank/PhishTankConfig.java
// @Component
// @Conditional(PhishTankCondition.class)
// public class PhishTankConfig {
//   private static final Logger LOGGER = LoggerFactory.getLogger(PhishTankConfig.class);
//   private static final String PARAMETER_API_KEY = "app_key";
//   private static final String PARAMETER_FORMAT = "format";
//   private static final String RESPONSE_FORMAT = "json";
//   private final String apiUrl;
//   private final MultiValueMap<String, String> parameters;
// 
//   @Autowired
//   public PhishTankConfig(PhishTankSettings settings) {
//     this.apiUrl = settings.getEndpoint();
//     this.parameters = new LinkedMultiValueMap<>();
//     parameters.add(PARAMETER_API_KEY, settings.getCredential());
//     parameters.add(PARAMETER_FORMAT, RESPONSE_FORMAT);
// 
//     if (!StringUtils.isEmpty(parameters.getFirst(PARAMETER_API_KEY))
//       && !StringUtils.isEmpty(parameters.get(PARAMETER_FORMAT))) {
//       LOGGER.info("PhishTank API is configured with an API key");
//     }
//   }
// 
//   public final String getApiUrl() {
//     return apiUrl;
//   }
// 
//   public final MultiValueMap<String, String> getParameters() {
//     return new LinkedMultiValueMap<>(parameters);
//   }
// }
// 
// Path: linkshortener-api/src/main/java/be/drissamri/config/safebrowsing/phishtank/PhishTankSettings.java
// @Component
// @Conditional(PhishTankCondition.class)
// public class PhishTankSettings implements ApiSettings {
//   private final String endpoint;
//   private final String credential;
// 
//   @Autowired
//   public PhishTankSettings(
//     @Value("${provider.phishtank.url}") final String endpoint,
//     @Value("${provider.phishtank.key}") final String credential) {
//     this.endpoint = endpoint;
//     this.credential = credential;
//   }
// 
//   @Override
//   public final String getEndpoint() {
//     return this.endpoint;
//   }
// 
//   @Override
//   public final String getCredential() {
//     return this.credential;
//   }
// 
//   @Override
//   public final String getVersion() {
//     return "v1";
//   }
// }


// Path: linkshortener-api/src/test/java/be/drissamri/service/verifier/PhishTankUrlVerifierTest.java
import be.drissamri.config.safebrowsing.phishtank.PhishTankConfig;
import be.drissamri.config.safebrowsing.phishtank.PhishTankSettings;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.*;

package be.drissamri.service.verifier;



public class PhishTankUrlVerifierTest {
  private PhishTankUrlVerifier phishTankUrlVerifier;
  @Mock
  private RestTemplate restTemplate;
  private static final String LONG_URL = "http://www.drissamri.be";
  private static final String JSON_PHISH_RESULT = "{ 'results': { 'in_database': true } }";
  private static final String JSON_SAFE_RESULT = "{ 'results': { 'in_database': false } }";
  private static final String JSON_UNKOWN_RESULT = "{ }";

  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    phishTankUrlVerifier = new PhishTankUrlVerifier(
        restTemplate,
        new PhishTankConfig(