use of jakarta.ws.rs.core.UriBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method resolveTemplatesFromEncodedThrowsNullOnNullValueTest.
/*
* @testName: resolveTemplatesFromEncodedThrowsNullOnNullValueTest
*
* @assertion_ids: JAXRS:JAVADOC:967;
*
* @test_Strategy: java.lang.IllegalArgumentException - if the name-value map
* or any of the names or values in the map is null.
*/
@Test
public void resolveTemplatesFromEncodedThrowsNullOnNullValueTest() throws Fault {
Map<String, Object> map = new HashMap<String, Object>();
map.put("v", null);
UriBuilder builder = UriBuilder.fromPath("").path("{v}/{w}/{x}/{y}/{w}");
try {
builder.resolveTemplatesFromEncoded(map);
fault("No exception has been thrown");
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException thrown as expected", e);
}
}
use of jakarta.ws.rs.core.UriBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method resolveTemplateStringObjectBooleanThrowsIAEOnNullValueTest.
/*
* @testName: resolveTemplateStringObjectBooleanThrowsIAEOnNullValueTest
*
* @assertion_ids: JAXRS:JAVADOC:959;
*
* @test_Strategy: if the resolved template name or value is null.
*/
@Test
public void resolveTemplateStringObjectBooleanThrowsIAEOnNullValueTest() throws Fault {
String template = "{v}/{w}/{x}/{y}/{w}";
UriBuilder builder = UriBuilder.fromPath("").path(template);
try {
builder.resolveTemplate("v", null, false);
fault("No exception has been thrown");
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown as expected", e);
}
}
use of jakarta.ws.rs.core.UriBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method resolveTemplateStringObjectThrowsIAEOnNullValueTest.
/*
* @testName: resolveTemplateStringObjectThrowsIAEOnNullValueTest
*
* @assertion_ids: JAXRS:JAVADOC:957;
*
* @test_Strategy: if the resolved template name or value is null.
*/
@Test
public void resolveTemplateStringObjectThrowsIAEOnNullValueTest() throws Fault {
String template = "{v}/{w}/{x}/{y}/{w}";
UriBuilder builder = UriBuilder.fromPath("").path(template);
try {
builder.resolveTemplate("v", null);
fault("No exception has been thrown");
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown as expected", e);
}
}
use of jakarta.ws.rs.core.UriBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method resolveTemplatesMapThrowsIAEOnNullNameTest.
/*
* @testName: resolveTemplatesMapThrowsIAEOnNullNameTest
*
* @assertion_ids: JAXRS:JAVADOC:963;
*
* @test_Strategy:java.lang.IllegalArgumentException - if the name-value map
* or any of the names or values in the map is null.
*/
@Test
public void resolveTemplatesMapThrowsIAEOnNullNameTest() throws Fault {
Map<String, Object> map = new HashMap<String, Object>();
map.put("a", new StringBuilder("x%yz"));
map.put(null, "path-rootless/test2");
UriBuilder builder = UriBuilder.fromPath("").path("{a}/{b}");
try {
builder.resolveTemplates(map);
fault("IllegalArgumentException has not been thrown");
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown as expected", e);
}
}
use of jakarta.ws.rs.core.UriBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method buildFromEncodedMapTest5.
/*
* @testName: buildFromEncodedMapTest5
*
* @assertion_ids: JAXRS:JAVADOC:182;
*
* @test_Strategy: Create multiple URI instances from the same UriBuilder
* instance using the UriBuilder.buildFromEncodedMap(Map); Verify that the
* builder is not affected.
*/
@Test
public void buildFromEncodedMapTest5() throws Fault {
UriBuilder ub;
Map<String, String> maps = new HashMap<String, String>();
maps.put("x", "x%yz");
maps.put("y", "/path-absolute/test1");
maps.put("z", "fred@example.com");
maps.put("w", "path-rootless/test2");
Map<String, String> maps1 = new HashMap<String, String>();
maps1.put("x", "x%20yz");
maps1.put("y", "/path-absolute/test1");
maps1.put("z", "fred@example.com");
maps1.put("w", "path-rootless/test2");
Map<String, String> maps2 = new HashMap<String, String>();
maps2.put("x", "x%yz");
maps2.put("y", "/path-absolute/test1");
maps2.put("z", "fred@example.com");
maps2.put("w", "path-rootless/test2");
maps2.put("v", "xyz");
String expected_path_1 = "path-rootless/test2/x%20yz//path-absolute/test1/fred@example.com/x%20yz";
try {
ub = UriBuilder.fromPath("").path("{w}/{x}/{y}/{z}/{x}");
uri = ub.buildFromEncodedMap(maps);
gotExpectedPass(uri.getRawPath(), EXPECTED_PATH);
uri = ub.buildFromEncodedMap(maps1);
gotExpectedPass(uri.getRawPath(), expected_path_1);
uri = ub.buildFromEncodedMap(maps2);
gotExpectedPass(uri.getRawPath(), EXPECTED_PATH);
} catch (Throwable ex) {
pass = false;
sb.append("Unexpected exception thrown: " + ex.getMessage() + newline);
}
assertPassAndLog();
}
Aggregations