RDFParserHelper { public static final Literal createLiteral(String label, String lang, IRI datatype, ParserConfig parserConfig, ParseErrorListener errListener, ValueFactory valueFactory) throws RDFParseException { return createLiteral(label, lang, datatype, parserConfig, errListener, valueFactory, -1, -1); } protected  RDFParserHelper(); static final Literal createLiteral(String label, String lang, IRI datatype, ParserConfig parserConfig,
			ParseErrorListener errListener, ValueFactory valueFactory); static final Literal createLiteral(String label, String lang, IRI datatype, ParserConfig parserConfig,
			ParseErrorListener errListener, ValueFactory valueFactory, long lineNo, long columnNo); static void reportError(String msg, RioSetting<Boolean> relevantSetting, ParserConfig parserConfig,
			ParseErrorListener errListener); static void reportError(String msg, long lineNo, long columnNo, RioSetting<Boolean> relevantSetting,
			ParserConfig parserConfig, ParseErrorListener errListener); static void reportError(Exception e, long lineNo, long columnNo, RioSetting<Boolean> relevantSetting,
			ParserConfig parserConfig, ParseErrorListener errListener); static void reportFatalError(String msg, ParseErrorListener errListener); static void reportFatalError(String msg, long lineNo, long columnNo, ParseErrorListener errListener); static void reportFatalError(Exception e, ParseErrorListener errListener); static void reportFatalError(Exception e, long lineNo, long columnNo, ParseErrorListener errListener); static void reportFatalError(String message, Exception e, long lineNo, long columnNo,
			ParseErrorListener errListener);  }
@Test public final void testCreateLiteralLabelNull() throws Exception { thrown.expect(NullPointerException.class); thrown.expectMessage("Cannot create a literal using a null label"); RDFParserHelper.createLiteral(null, null, null, parserConfig, errListener, valueFactory); }
@Test public final void testCreateLiteralLabelOnly() throws Exception { Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, null, null, parserConfig, errListener, valueFactory); assertEquals(LABEL_TESTA, literal.getLabel()); assertFalse(literal.getLanguage().isPresent()); assertEquals(XSD.STRING, literal.getDatatype()); }
@Test public final void testCreateLiteralLabelAndLanguage() throws Exception { Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, LANG_EN, null, parserConfig, errListener, valueFactory); assertEquals(LABEL_TESTA, literal.getLabel()); assertEquals(LANG_EN, literal.getLanguage().orElse(null)); assertEquals(RDF.LANGSTRING, literal.getDatatype()); }
@Test public final void testCreateLiteralLabelAndDatatype() throws Exception { Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, null, XSD.STRING, parserConfig, errListener, valueFactory); assertEquals(LABEL_TESTA, literal.getLabel()); assertFalse(literal.getLanguage().isPresent()); assertEquals(XSD.STRING, literal.getDatatype()); }
@Test public final void testCreateLiteralLabelAndLanguageWithRDFLangString() throws Exception { Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, LANG_EN, RDF.LANGSTRING, parserConfig, errListener, valueFactory); assertEquals(LABEL_TESTA, literal.getLabel()); assertEquals(LANG_EN, literal.getLanguage().orElse(null)); assertEquals(RDF.LANGSTRING, literal.getDatatype()); }
@Test public final void testCreateLiteralLabelNoLanguageWithRDFLangStringWithVerify() throws Exception { parserConfig.set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true); assertTrue(parserConfig.get(BasicParserSettings.VERIFY_DATATYPE_VALUES)); thrown.expect(RDFParseException.class); RDFParserHelper.createLiteral(LABEL_TESTA, null, RDF.LANGSTRING, parserConfig, errListener, valueFactory); }
@Test public final void testCreateLiteralLabelNoLanguageWithRDFLangStringWithNoVerify() throws Exception { parserConfig.set(BasicParserSettings.VERIFY_DATATYPE_VALUES, false); Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, null, RDF.LANGSTRING, parserConfig, errListener, valueFactory); assertFalse(literal.getLanguage().isPresent()); assertEquals(XSD.STRING, literal.getDatatype()); }