### Question:
ValueDecoder { protected Value decodeValue(String string) throws BadRequestException { Value result = null; try { if (string != null) { String value = string.trim(); if (!value.isEmpty() && !"null".equals(value)) { if (value.startsWith("_:")) { String label = value.substring("_:".length()); result = factory.createBNode(label); } else { if (value.charAt(0) == '<' && value.endsWith(">")) { result = factory.createIRI(value.substring(1, value.length() - 1)); } else { if (value.charAt(0) == '"') { result = parseLiteral(value); } else { result = parseURI(value); } } } } } } catch (Exception exc) { LOGGER.warn(exc.toString(), exc); throw new BadRequestException("Malformed value: " + string, exc); } return result; } protected  ValueDecoder(Repository repository, ValueFactory factory);   }### Answer:
@Test public final void testLiteralWithURIType() throws BadRequestException { Value value = decoder.decodeValue("\"1\"^^<" + XMLSchema.INT + ">"); assertThat(value).isInstanceOf(Literal.class); assertThat((Literal) value).isEqualTo(factory.createLiteral(1)); }
@Test public final void testQnamePropertyValue() throws BadRequestException { Value value = decoder.decodeValue("rdfs:label"); assertThat(value).isInstanceOf(IRI.class); assertThat((IRI) value).isEqualTo(RDFS.LABEL); }
@Test public final void testPlainStringLiteral() throws BadRequestException { Value value = decoder.decodeValue("\"plain string\""); assertThat(value).isInstanceOf(Literal.class); assertThat((Literal) value).isEqualTo(factory.createLiteral("plain string")); }
@Test public final void testUnexpectedLiteralAttribute() throws BadRequestException { try { decoder.decodeValue("\"datatype oops\"^rdfs:label"); fail("Expected BadRequestException."); } catch (BadRequestException bre) { Throwable rootCause = bre.getRootCause(); assertThat(rootCause).isInstanceOf(BadRequestException.class); assertThat(rootCause).hasMessageStartingWith("Malformed language tag or datatype: "); } }
@Test public final void testLiteralWithQNameType() throws BadRequestException { Value value = decoder.decodeValue("\"1\"^^xsd:int"); assertThat(value).isInstanceOf(Literal.class); assertThat((Literal) value).isEqualTo(factory.createLiteral(1)); }
@Test public final void testLiteralWithURIType() throws BadRequestException { Value value = decoder.decodeValue("\"1\"^^<" + XSD.INT + ">"); assertThat(value).isInstanceOf(Literal.class); assertThat((Literal) value).isEqualTo(factory.createLiteral(1)); }
@Test public final void testLanguageLiteral() throws BadRequestException { Value value = decoder.decodeValue("\"color\"@en-US"); assertThat(value).isInstanceOf(Literal.class); assertThat((Literal) value).isEqualTo(factory.createLiteral("color", "en-US")); }