@Test public void mapTypes() { MediaType type = new MediaType("application", "json", Charset.forName("UTF-8")); MediaType q = new MediaType(type, new HashMap<String, String>() { { put("charset", "UTF-8"); put("q", "0.2"); } }); assertThat(q, is(MediaType.parseMediaType("application/json;q=0.2;charset=UTF-8"))); assertThat(q, not(is(MediaType.parseMediaType("application/json;charset=UTF-8")))); assertThat(new ResultFormatterFactory().create(MediaType.parseMediaType("text/html;charset=UTF-8")), instanceOf(ResultFormatterJSONv2.class)); assertThat(new ResultFormatterFactory().create(MediaType.parseMediaType("application/json;charset=UTF-8")), instanceOf(ResultFormatterJSON.class)); }
public ResultFormatter create(MediaType type) { return TYPE_TO_FORMATTER_MAP.get(type == null ? JSON : type); }
ResultFormatterFactory { public ResultFormatter create(MediaType type) { return TYPE_TO_FORMATTER_MAP.get(type == null ? JSON : type); } }
ResultFormatterFactory { public ResultFormatter create(MediaType type) { return TYPE_TO_FORMATTER_MAP.get(type == null ? JSON : type); }  }
ResultFormatterFactory { public ResultFormatter create(MediaType type) { return TYPE_TO_FORMATTER_MAP.get(type == null ? JSON : type); }  ResultFormatter create(MediaType type); }
ResultFormatterFactory { public ResultFormatter create(MediaType type) { return TYPE_TO_FORMATTER_MAP.get(type == null ? JSON : type); }  ResultFormatter create(MediaType type); static final MediaType JSON; }