QueryStringUtil { public static String valueToString(Value value) { return appendValueAsString(new StringBuilder(), value).toString(); }  @Deprecated static String getQueryString(String queryString, BindingSet bindings); static String getTupleQueryString(String queryString, BindingSet bindings); static String getUpdateString(String queryString, BindingSet bindings); static String getBooleanQueryString(String queryString, BindingSet bindings); static String getGraphQueryString(String queryString, BindingSet bindings); static String valueToString(Value value); static StringBuilder appendValueAsString(StringBuilder sb, Value value);  }
@Test public void testIRI() { IRI iri = VF.createIRI("http: assertEquals("<http: assertEquals("<http: }
@Test public void testSimpleLiteral() { Literal literal = VF.createLiteral("simple \"literal\""); assertEquals("\"simple \\\"literal\\\"\"", QueryStringUtil.valueToString(literal)); assertEquals("\"simple \\\"literal\\\"\"", valueToStringWithStringBuilder(literal)); }
@Test public void testLanguageLiteral() { Literal literal = VF.createLiteral("lang \"literal\"", "en"); assertEquals("\"lang \\\"literal\\\"\"@en", QueryStringUtil.valueToString(literal)); assertEquals("\"lang \\\"literal\\\"\"@en", valueToStringWithStringBuilder(literal)); }
@Test public void testTypedLiteral() { Literal literal = VF.createLiteral("typed \"literal\"", VF.createIRI("http: assertEquals("\"typed \\\"literal\\\"\"^^<http: assertEquals("\"typed \\\"literal\\\"\"^^<http: }
@Test public void testNullValue() { assertEquals("UNDEF", QueryStringUtil.valueToString(null)); assertEquals("UNDEF", valueToStringWithStringBuilder(null)); }
@Test public void testBNode() { try { QueryStringUtil.valueToString(VF.createBNode()); fail("Must throw exception"); } catch (IllegalArgumentException e) { } try { valueToStringWithStringBuilder(VF.createBNode()); fail("Must throw exception"); } catch (IllegalArgumentException e) { } }