### Question:
Serializer { public void writeLiteral(Literal literal) throws IOException { if (literal.isNegated()) { writer.write("~"); } writePositiveLiteral(literal.getPredicate(), literal.getArguments()); } Serializer(final Writer writer, final Function<String, String> iriTransformer);  Serializer(final Writer writer);  Serializer(final Writer writer, PrefixDeclarationRegistry prefixDeclarationRegistry); void writeStatement(Statement statement); void writeFact(Fact fact); void writeRule(Rule rule); void writeDataSourceDeclaration(DataSourceDeclaration dataSourceDeclaration); void writeLiteral(Literal literal); void writePositiveLiteral(Predicate predicate, List<Term> arguments); void writeLiteralConjunction(final Conjunction<? extends Literal> literals); void writePredicate(Predicate predicate); void writeTerm(Term term); void writeAbstractConstant(AbstractConstant abstractConstant); void writeDatatypeConstant(DatatypeConstant datatypeConstant); void writeDatatypeConstantNoAbbreviations(DatatypeConstant datatypeConstant); void writeUniversalVariable(UniversalVariable universalVariable); void writeExistentialVariable(ExistentialVariable existentialVariable); void writeNamedNull(NamedNull namedNull); boolean writePrefixDeclarationRegistry(PrefixDeclarationRegistry prefixDeclarationRegistry); void writeLanguageStringConstant(LanguageStringConstant languageStringConstant); void writeCommand(Command command); static String getSerialization(SerializationWriter writeAction); static final String STATEMENT_END; static final Function<String, String> identityIriSerializer; }### Answer:
@Test public void serializePositiveLiteral() throws IOException { serializer.writeLiteral(l1); assertEquals("p1(?X)", writer.toString()); }
@Test public void serializeNegativeLiteral() throws IOException { serializer.writeLiteral(ln1); assertEquals("~p1(!X)", writer.toString()); }