use of jakarta.ws.rs.core.EntityTag in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorTest1.
/*
* @testName: constructorTest1
*
* @assertion_ids: JAXRS:JAVADOC:62; JAXRS:JAVADOC:65; JAXRS:JAVADOC:67;
*
* @test_Strategy: Create an EntityTag instance using entityTag(String)
*/
@Test
public void constructorTest1() throws Fault {
String value = "cts test entity tag test";
boolean strong = true;
EntityTag et1 = new EntityTag(value);
verifyEntityTag(et1, value, strong);
}
use of jakarta.ws.rs.core.EntityTag in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method toStringTest.
/*
* @testName: toStringTest
*
* @assertion_ids: JAXRS:JAVADOC:62; JAXRS:JAVADOC:63; JAXRS:JAVADOC:68;
*
* @test_Strategy: Create two EntityTag instances using either entityTag(String,
* boolean) and entityTag(String). Verify EntityTag.toString() works
*/
@Test
public void toStringTest() throws Fault {
boolean pass = true;
StringBuffer sb = new StringBuffer();
String value = "cts test Strong EntityTag test";
EntityTag et8 = new EntityTag(value);
String header = et8.toString();
sb.append(header + "." + newline);
if (!header.contains(value)) {
pass = false;
sb.append("Strong EnttyTag ToString Test failed: " + header + " does not contain " + value);
}
value = "cts test Weak EntityTag test";
EntityTag et9 = new EntityTag(value, true);
header = et9.toString();
sb.append(header + "." + newline);
if (!header.contains(value)) {
pass = false;
sb.append("Weak EnttyTag ToString Test failed: " + header + " does not contain " + value);
}
assertTrue(pass, "At least one assertion failed: " + sb.toString());
System.out.println(sb.toString());
}
use of jakarta.ws.rs.core.EntityTag in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorTest2.
/*
* @testName: constructorTest2
*
* @assertion_ids: JAXRS:JAVADOC:63; JAXRS:JAVADOC:65; JAXRS:JAVADOC:67;
*
* @test_Strategy: Create an EntityTag instance using entityTag(String, boolean)
*/
@Test
public void constructorTest2() throws Fault {
String value = "cts test entity tag test weak";
boolean strong = false;
EntityTag et2 = new EntityTag(value, true);
verifyEntityTag(et2, value, strong);
strong = true;
EntityTag et3 = new EntityTag(value, false);
verifyEntityTag(et3, value, strong);
}
use of jakarta.ws.rs.core.EntityTag in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method getEntityTag.
@POST
@Path("entitytag")
public Response getEntityTag(String tag) {
ResponseBuilder builder;
if (tag != null && tag.length() != 0) {
EntityTag entityTag = new EntityTag(tag);
builder = Response.notModified(entityTag);
} else
builder = Response.ok();
Response response = builder.build();
return response;
}
use of jakarta.ws.rs.core.EntityTag in project jaxrs-api by eclipse-ee4j.
the class ResponseFilter method getEntityTag.
public void getEntityTag() {
EntityTag tag = responseContext.getEntityTag();
setEntity(tag == null ? NULL : tag.getValue());
}
Aggregations