### Question:
CypherUtil { public String resolveRelationships(String cypher) { Matcher m = ENTAILMENT_PATTERN.matcher(cypher); StringBuffer buffer = new StringBuffer(); while (m.find()) { String varName = m.group(1); String types = m.group(2); String modifiers = m.group(3); Collection<String> resolvedTypes = resolveTypes(types, modifiers.contains("!")); modifiers = modifiers.replaceAll("!", ""); String typeString = resolvedTypes.isEmpty() ? "" : ":`" + on("`|`").join(resolvedTypes) + "`"; m.appendReplacement(buffer, "[" + varName + typeString + modifiers + "]"); } m.appendTail(buffer); return buffer.toString(); } @Inject  CypherUtil(GraphDatabaseService graphDb, CurieUtil curieUtil); Result execute(String query, Multimap<String, Object> params, long timeout, TimeUnit unit); Result execute(String query, long timeout, TimeUnit unit); Result execute(String query, Multimap<String, Object> params); Result execute(String query); Set<RelationshipType> getEntailedRelationshipTypes(Collection<String> parents); @Deprecated String resolveStartQuery(String cypher); String resolveNodeIris(String cypher); String resolveRelationships(String cypher); Map<String, String> getCurieMap();  }### Answer:
@Test public void jsonPropertiesAreNotRegexed() { String query = util.resolveRelationships("(a {foo: 'bar'})-[:fizz*]-(end)"); assertThat(query, is("(a {foo: 'bar'})-[:`fizz`*]-(end)")); }
@Test public void replaceCurieRelationship() { String actual = util.resolveRelationships("(start)-[:FOO:foo]-(end)"); assertThat(actual, is("(start)-[:`http: }
@Test public void simpleQuery() { String query = util.resolveRelationships("(a)-[r]-(b)"); assertThat(query, is("(a)-[r]-(b)")); }
@Test public void simpleQueryWithDepth() { String query = util.resolveRelationships("(a)-[:r*0..1]-(b)"); assertThat(query, is("(a)-[:`r`*0..1]-(b)")); }