<commit_before>package com.wikia.mobileconfig.service;

import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import com.wikia.mobileconfig.core.EmptyMobileConfiguration;
import com.wikia.mobileconfig.core.MobileConfiguration;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.IOException;

public class HttpConfigurationServiceTest {
  private HttpClient httpClient;
  private ObjectMapper objectMapper;
  private String cephDomain = "ceph-domain";
  private String cephPort = "80";
  private HttpConfigurationService configService;

  @Before
  public void initialize() {
    httpClient = mock(HttpClient.class);
    objectMapper = mock(ObjectMapper.class);
    configService = new HttpConfigurationService(httpClient, objectMapper, cephDomain, cephPort);
  }

  @Test
  public void getEmptyConfiguration() throws Exception {
    when(httpClient.execute(any(HttpGet.class), any(BasicResponseHandler.class))).thenThrow(IOException.class);
    MobileConfiguration
        config = configService.getConfiguration("testPlatform", "testTag", "xx", "xx");
    assertThat(config).isExactlyInstanceOf(EmptyMobileConfiguration.class);
  }

  @Test
  public void getDefaultConfiguration() throws Exception {
    MobileConfiguration cfgMock = new ObjectMapper().readValue(
        new File("src/test/resources/fixtures/test-platform:test-app.json"),
        MobileConfiguration.class
    );

    when(objectMapper.readValue(anyString(), MobileConfiguration.class)).thenReturn(cfgMock);
    MobileConfiguration config = configService.getDefault("testPlatform");
    assertThat(config).isExactlyInstanceOf(MobileConfiguration.class);
  }
}<commit_msg>fixing unit test when<commit_after>package com.wikia.mobileconfig.service;

import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import com.wikia.mobileconfig.core.EmptyMobileConfiguration;
import com.wikia.mobileconfig.core.MobileConfiguration;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.IOException;

public class HttpConfigurationServiceTest {
  private HttpClient httpClient;
  private ObjectMapper objectMapper;
  private String cephDomain = "ceph-domain";
  private String cephPort = "80";
  private HttpConfigurationService configService;

  @Before
  public void initialize() {
    httpClient = mock(HttpClient.class);
    objectMapper = mock(ObjectMapper.class);
    configService = new HttpConfigurationService(httpClient, objectMapper, cephDomain, cephPort);
  }

  @Test
  public void getEmptyConfiguration() throws Exception {
    when(httpClient.execute(any(HttpGet.class), any(BasicResponseHandler.class))).thenThrow(IOException.class);
    MobileConfiguration
        config = configService.getConfiguration("testPlatform", "testTag", "xx", "xx");
    assertThat(config).isExactlyInstanceOf(EmptyMobileConfiguration.class);
  }

  @Test
  public void getDefaultConfiguration() throws Exception {
    MobileConfiguration cfgMock = new ObjectMapper().readValue(
        new File("src/test/resources/fixtures/test-platform:test-app.json"),
        MobileConfiguration.class
    );

    when(objectMapper.readValue(anyString(), eq(MobileConfiguration.class))).thenReturn(cfgMock);
    MobileConfiguration config = configService.getDefault("testPlatform");
    assertThat(config).isExactlyInstanceOf(MobileConfiguration.class);
  }
}
{'fraction_non_alphanumeric': 0.10127803231251507, 'fraction_numerical': 0.0009645526886906198, 'mean_word_length': 5.668810289389068, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3962301', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1122, 'n_words': 216}