@Test public void includes() throws Exception { MediaType textPlain = MediaType.TEXT_PLAIN; assertTrue("Equal types is not inclusive", textPlain.includes(textPlain)); MediaType allText = new MediaType("text"); assertTrue("All subtypes is not inclusive", allText.includes(textPlain)); assertFalse("All subtypes is inclusive", textPlain.includes(allText)); assertTrue("All types is not inclusive", MediaType.ALL.includes(textPlain)); assertFalse("All types is inclusive", textPlain.includes(MediaType.ALL)); assertTrue("All types is not inclusive", MediaType.ALL.includes(textPlain)); assertFalse("All types is inclusive", textPlain.includes(MediaType.ALL)); MediaType applicationSoapXml = new MediaType("application", "soap+xml"); MediaType applicationWildcardXml = new MediaType("application", "*+xml"); assertTrue(applicationSoapXml.includes(applicationSoapXml)); assertTrue(applicationWildcardXml.includes(applicationWildcardXml)); assertTrue(applicationWildcardXml.includes(applicationSoapXml)); assertFalse(applicationSoapXml.includes(applicationWildcardXml)); }