コード例 #1
0
 @Test
 public void shouldUseSpecifieDefaultCharsetProperty() {
   List<Header> headers = new ArrayList<Header>();
   headers.add(new RestData.Header("Content-Type", "application/json"));
   Config c = Config.getConfig();
   c.add("restfixture.content.handlers.map", confMap());
   c.add("restfixture.content.default.charset", "MY-CHARSET");
   ContentType.config(c);
   assertEquals(ContentType.parseCharset(headers), "MY-CHARSET");
 }
コード例 #2
0
 @Test
 public void
     shouldUseDefaultSystemCharsetIfCharsetNotParseableAndDefaultNotSpecifiedViaProperty() {
   List<Header> headers = new ArrayList<Header>();
   headers.add(new RestData.Header("Content-Type", "application/json"));
   Config c = Config.getConfig();
   c.add("restfixture.content.handlers.map", confMap());
   c.add("restfixture.content.default.charset", null);
   ContentType.config(c);
   assertEquals(ContentType.parseCharset(headers), Charset.defaultCharset().name());
 }
コード例 #3
0
 @Test
 public void shouldParseTheCharset() {
   List<Header> headers = new ArrayList<Header>();
   headers.add(new RestData.Header("Content-Type", "application/json; charset=UTF-8"));
   assertEquals(ContentType.parseCharset(headers), "UTF-8");
 }