### Question:
SparqlUpdateHelper { public static String getObjectAsString(Object object) { if (object instanceof Resource) { return '<' + ((Resource) object).getURI() + '>'; } else if (object instanceof String) { return '"' + object.toString() + '"'; } else if (object instanceof Literal) { Literal literal = (Literal) object; RDFDatatype type = literal.getDatatype(); return '"' + literal.getLexicalForm() + "\"^^<" + type.getURI() + ">"; } else { RDFDatatype type = TypeMapper.getInstance().getTypeByClass(object.getClass()); if (type == null) { throw new IllegalArgumentException("Cannot convert object of type " + object.getClass() + ", only supported XSD datatypes and Resources are supported."); } String typeUri = type.getURI(); return '"' + object.toString() + "\"^^<" + typeUri + ">"; } } private  SparqlUpdateHelper(); static String createSparqlInsert(Model model); static String createSparqlInsert(String subjUri, Property property,
            Object object); static String createSparqlReplace(String subjUri, Property property, Object object); static String createSparqlReplace(String subjUri, Property property,
            Object object, List<Object> previousValues); static String createSparqlDelete(String subjUri, Property property, Object object); static String getObjectAsString(Object object);  }### Answer:
@Test public void getObjectAsStringStringTest() { String objString = SparqlUpdateHelper.getObjectAsString("test"); assertEquals("\"test\"", objString); }
@Test public void getObjectAsStringResourceTest() { Resource resc = ModelFactory.createDefaultModel().getResource(RESC_URI); String objString = SparqlUpdateHelper.getObjectAsString(resc); assertEquals("<" + RESC_URI + ">", objString); }
@Test public void getObjectAsStringBooleanTest() { String objString = SparqlUpdateHelper.getObjectAsString(false); assertEquals("\"false\"^^<http: }
@Test(expected = IllegalArgumentException.class) public void getObjectAsStringNonapplicableTest() { SparqlUpdateHelper.getObjectAsString(new Object()); }