### Question:
TermFactory { public Predicate makePredicate(String name, int arity) { String key = name + "#" + String.valueOf(arity); if (predicates.containsKey(key)) { return predicates.get(key); } else { Predicate result = new PredicateImpl(name, arity); predicates.put(key, result); return result; } } TermFactory();  TermFactory(int cacheSize); UniversalVariable makeUniversalVariable(String name); ExistentialVariable makeExistentialVariable(String name); AbstractConstant makeAbstractConstant(String name); DatatypeConstant makeDatatypeConstant(String lexicalValue, String datatypeIri); LanguageStringConstant makeLanguageStringConstant(String string, String languageTag); Predicate makePredicate(String name, int arity);  }### Answer:
@Test public void predicate_reused() { TermFactory termFactory = new TermFactory(); Predicate pred1 = termFactory.makePredicate("p", 1); Predicate pred2 = termFactory.makePredicate("q", 1); Predicate pred3 = termFactory.makePredicate("p", 2); Predicate pred4 = termFactory.makePredicate("p", 1); assertNotEquals(pred1, pred2); assertNotEquals(pred1, pred3); assertTrue(pred1 == pred4); }