use of jakarta.ws.rs.core.Variant in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorTest2.
/*
* @testName: constructorTest2
*
* @assertion_ids: JAXRS:JAVADOC:255; JAXRS:JAVADOC:256; JAXRS:JAVADOC:257;
* JAXRS:JAVADOC:261; JAXRS:JAVADOC:262;
*
* @test_Strategy: Create an MediaType instance using MediaType(String,
* String)
*/
@Test
public void constructorTest2() throws Fault {
String type = "application";
String subtype = "atom+xml";
String encoding = "";
Locale lang = null;
MediaType mt2 = new MediaType(type, subtype);
Variant vt = new Variant(mt2, lang, encoding);
verifyVariant(vt, type, subtype, lang, encoding);
}
use of jakarta.ws.rs.core.Variant in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method equalsTest2.
/*
* @testName: equalsTest2
*
* @assertion_ids: JAXRS:JAVADOC:262; JAXRS:JAVADOC:254; JAXRS:JAVADOC:258;
*
* @test_Strategy: Create two Variants with different MediaType. Verify
* Variant.equals and Variant.hasCode methods work properly using those two
* Variant objects.
*/
@Test
public void equalsTest2() throws Fault {
StringBuffer sb = new StringBuffer();
Boolean pass = true;
String type = "application";
String subtype = "atom+xml";
String subtype1 = "xml";
String encoding = "";
Locale lang = null;
MediaType mt1 = new MediaType(type, subtype);
MediaType mt2 = new MediaType(type, subtype1);
Variant vt1 = new Variant(mt1, lang, encoding);
Variant vt2 = new Variant(mt2, lang, encoding);
if (vt1.equals(vt2)) {
pass = false;
sb.append("Equals Test2 Failed" + newline);
}
if (vt1.hashCode() == vt2.hashCode()) {
sb.append("hasCode Test2 Failed: vt1.hashCode()=" + vt1.hashCode() + newline);
sb.append(" vt2.hashCode()=" + vt2.hashCode() + newline);
pass = false;
}
assertTrue(pass, "At least one assertion failed: " + sb.toString());
}
use of jakarta.ws.rs.core.Variant in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorTest1.
/* Run test */
/*
* @testName: constructorTest1
*
* @assertion_ids: JAXRS:JAVADOC:255; JAXRS:JAVADOC:256; JAXRS:JAVADOC:257;
* JAXRS:JAVADOC:261; JAXRS:JAVADOC:262;
*
* @test_Strategy: Create an MediaType instance using MediaType()
*/
@Test
public void constructorTest1() throws Fault {
String type = jakarta.ws.rs.core.MediaType.MEDIA_TYPE_WILDCARD;
String subtype = jakarta.ws.rs.core.MediaType.MEDIA_TYPE_WILDCARD;
String encoding = "ISO8859-15";
Locale lang = new Locale("en", "US");
MediaType mt1 = new MediaType();
Variant vt = new Variant(mt1, lang, encoding);
verifyVariant(vt, type, subtype, lang, encoding);
}
use of jakarta.ws.rs.core.Variant in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorMediaStringStringStringTest.
/*
* @testName: constructorMediaStringStringStringTest
*
* @assertion_ids: JAXRS:JAVADOC:901;
*
* @test_Strategy: Create a Variant(MediaType, String, String, String)
*/
@Test
public void constructorMediaStringStringStringTest() throws Fault {
Variant vt = null;
String[] encodings = { null, "CP1250", "UTF8", "ISO8859-2" };
Locale[] langs = { null, Locale.CANADA, Locale.FRENCH };
for (String encoding : encodings) for (Locale lang : langs) {
vt = new Variant(MediaType.APPLICATION_XHTML_XML_TYPE, lang == null ? null : lang.getLanguage(), lang == null ? null : lang.getCountry(), encoding);
verifyVariant(vt, MediaType.APPLICATION_XHTML_XML_TYPE.getType(), MediaType.APPLICATION_XHTML_XML_TYPE.getSubtype(), lang, encoding);
}
}
use of jakarta.ws.rs.core.Variant in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorMediaStringStringTest.
/*
* @testName: constructorMediaStringStringTest
*
* @assertion_ids: JAXRS:JAVADOC:900;
*
* @test_Strategy: Create a Variant(MediaType, String, String)
*/
@Test
public void constructorMediaStringStringTest() throws Fault {
Variant vt = null;
String[] encodings = { null, "CP1250", "UTF8", "ISO8859-2" };
Locale[] langs = { null, Locale.CANADA, Locale.FRENCH };
for (String encoding : encodings) for (Locale lang : langs) {
vt = new Variant(MediaType.APPLICATION_XHTML_XML_TYPE, lang == null ? null : lang.toString(), encoding);
verifyVariant(vt, MediaType.APPLICATION_XHTML_XML_TYPE.getType(), MediaType.APPLICATION_XHTML_XML_TYPE.getSubtype(), lang, encoding);
}
}
Aggregations