Search in sources :

Example 11 with QualitySourceMediaType

use of org.glassfish.jersey.message.internal.QualitySourceMediaType in project jersey by jersey.

the class QualitySourceMediaTypeProviderTest method testMultipleMediaTypeWithQuality.

@Test
public void testMultipleMediaTypeWithQuality() throws Exception {
    final String header = "application/xml;qs=0.1, text/xml;qs=0.2, text/html;qs=0.3";
    final List<QualitySourceMediaType> l = HttpHeaderReader.readQualitySourceMediaType(header);
    assertEquals(3, l.size());
    MediaType m;
    m = l.get(0);
    assertEquals("text", m.getType());
    assertEquals("html", m.getSubtype());
    assertEquals(1, m.getParameters().size());
    m = l.get(1);
    assertEquals("text", m.getType());
    assertEquals("xml", m.getSubtype());
    assertEquals(1, m.getParameters().size());
    m = l.get(2);
    assertEquals("application", m.getType());
    assertEquals("xml", m.getSubtype());
    assertEquals(1, m.getParameters().size());
}
Also used : MediaType(javax.ws.rs.core.MediaType) QualitySourceMediaType(org.glassfish.jersey.message.internal.QualitySourceMediaType) QualitySourceMediaType(org.glassfish.jersey.message.internal.QualitySourceMediaType) Test(org.junit.Test)

Aggregations

MediaType (javax.ws.rs.core.MediaType)11 QualitySourceMediaType (org.glassfish.jersey.message.internal.QualitySourceMediaType)11 Test (org.junit.Test)11