### Question:
SPARQLVisitor extends SerializerBase<SPARQLVisitor> implements RDFVisitor<Void, Void> { public void setLikeAsMatches(boolean likeAsMatches) { this.likeAsMatches = likeAsMatches; } SPARQLVisitor();  SPARQLVisitor(SPARQLTemplates templates, String prefix); @Nullable Void visit(QueryMetadata md, QueryLanguage<?, ?> queryType); @SuppressWarnings("unchecked") @Override Void visit(SubQueryExpression<?> expr, Void context); @Nullable Void visit(UnionBlock expr, @Nullable Void context); @Nullable Void visit(GroupBlock expr, @Nullable Void context); @Nullable Void visit(GraphBlock expr, @Nullable Void context); @Nullable Void visit(OptionalBlock expr, @Nullable Void context); @SuppressWarnings("unchecked") @Override void visitConstant(Object constant); @Nullable Void visit(PatternBlock expr, @Nullable Void context); @Override @Nullable Void visit(ParamExpression<?> param, @Nullable Void context); void addBindings(SPARQLQuery query, QueryMetadata md); void setInlineResources(boolean b); void setLikeAsMatches(boolean likeAsMatches); void setInlineAll(boolean inlineAll); void setInToOr(boolean inToOr);  }### Answer:
@Test public void Like_as_Matches() { visitor.setLikeAsMatches(true); visitor.handle(PredicateOperation.create(Ops.LIKE, QNODE.o, new ConstantImpl(LIT.class, new LIT("x%")))); assertEquals("regex(?o, ?_c2)", visitor.toString()); assertTrue(visitor.getConstantToLabel().containsKey(new LIT("x.*"))); }
@Test public void Like_as_Matches_2() { visitor.setLikeAsMatches(true); visitor.handle(PredicateOperation.create(Ops.LIKE, QNODE.o, new ConstantImpl(LIT.class, new LIT("x_")))); assertEquals("regex(?o, ?_c2)", visitor.toString()); assertTrue(visitor.getConstantToLabel().containsKey(new LIT("x."))); }