package ro.isdc.wro.http.support;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

import org.junit.Test;


public class TestContentTypeResolver {
  
  @Test
  public void shouldResolveCSSExtenstion() {
    assertThat(ContentTypeResolver.get("somefile.css"), is("text/css"));
  }
  
  @Test
  public void shouldResolveJPGExtenstion() {
    assertThat(ContentTypeResolver.get("s/bvews/omefile.jpg"), is("image/jpeg"));
  }

  @Test
   public void shouldResolveJPGExtenstionWithoutCharset() {
     assertThat(ContentTypeResolver.get("s/bvews/omefile.jpg", "UTF-8"), is("image/jpeg"));
   }
  
  @Test
  public void shouldResolveHTMLExtenstion() {
    assertThat(ContentTypeResolver.get("mefile.html"), is("text/html"));
  }

  @Test
  public void shouldResolveHTMLExtenstionWitCharset() {
    assertThat(ContentTypeResolver.get("mefile.html", "UTF-8"), is("text/html; charset=UTF-8"));
  }
  
  @Test
  public void shouldResolveJSExtenstion() {
    assertThat(ContentTypeResolver.get("/ad/df/mefile.js"), is("application/javascript"));
  }
  
  @Test
  public void shouldResolveUnknownExtenstion() {
    assertThat(ContentTypeResolver.get("/ad/df/mefile.unknown"), is("application/octet-stream"));
  }

  @Test
  public void shouldOnlyUseLastDot() {
    assertThat(ContentTypeResolver.get("somefile.js.png"), is("image/png"));
  }

  @Test
   public void shouldResolveHTMLUpperCaseExtenstion() {
     assertThat(ContentTypeResolver.get("mefile.CSS"), is("text/css"));
   }
  
  @Test
  public void shouldResolveFontExtensionEot() {
    assertThat(ContentTypeResolver.get("font.eot"), is("application/vnd.ms-fontobject"));
  }
  
  @Test
  public void shouldResolveFontExtensionOtf() {
    assertThat(ContentTypeResolver.get("font.otf"), is("application/x-font-opentype"));
  }
  
  @Test
  public void shouldResolveFontExtensionTtf() {
    assertThat(ContentTypeResolver.get("font.ttf"), is("application/octet-stream"));
  }
}

package ro.isdc.wro.http.support;

import static junit.framework.Assert.assertEquals;

import org.junit.Test;


public class TestContentTypeResolver {

  @Test
  public void shouldResolveCSSExtenstion() {
    assertEquals("text/css", ContentTypeResolver.get("somefile.css"));
  }

  @Test
  public void shouldResolveJPGExtenstion() {
    assertEquals("image/jpeg", ContentTypeResolver.get("s/bvews/omefile.jpg"));
  }

  @Test
   public void shouldResolveJPGExtenstionWithoutCharset() {
    assertEquals("image/jpeg", ContentTypeResolver.get("s/bvews/omefile.jpg", "UTF-8"));
   }

  @Test
  public void shouldResolveHTMLExtenstion() {
    assertEquals("text/html", ContentTypeResolver.get("mefile.html"));
  }

  @Test
  public void shouldResolveHTMLExtenstionWitCharset() {
    assertEquals("text/html; charset=UTF-8", ContentTypeResolver.get("mefile.html", "UTF-8"));
  }

  @Test
  public void shouldResolveJSExtenstion() {
    assertEquals("application/javascript", ContentTypeResolver.get("/ad/df/mefile.js"));
  }

  @Test
  public void shouldResolveUnknownExtenstion() {
    assertEquals("application/octet-stream", ContentTypeResolver.get("/ad/df/mefile.unknown"));
  }

  @Test
  public void shouldOnlyUseLastDot() {
    assertEquals("image/png", ContentTypeResolver.get("somefile.js.png"));
  }

  @Test
   public void shouldResolveHTMLUpperCaseExtenstion() {
    assertEquals("text/css", ContentTypeResolver.get("mefile.CSS"));
   }

  @Test
  public void shouldResolveFontExtensionEot() {
    assertEquals("application/vnd.ms-fontobject", ContentTypeResolver.get("font.eot"));
  }

  @Test
  public void shouldResolveFontExtensionOtf() {
    assertEquals("application/x-font-opentype", ContentTypeResolver.get("font.otf"));
  }

  @Test
  public void shouldResolveFontExtensionTtf() {
    assertEquals("application/octet-stream", ContentTypeResolver.get("font.ttf"));
  }
}

use assertEquals instead of org.hamcrest.MatcherAssert.Is which fails on TravisCI