Search in sources :

Example 1 with Replacer

use of org.neo4j.shell.impl.BashVariableInterpreter.Replacer in project neo4j by neo4j.

the class BashVariableInterpreterTest method customInterpreter.

@Test
public void customInterpreter() throws Exception {
    // GIVEN
    interpreter.addReplacer("test", new Replacer() {

        @Override
        public String getReplacement(ShellServer server, Session session) throws ShellException {
            return "Hello";
        }
    });
    // WHEN
    String interpreted = interpreter.interpret("\\test world", server, session);
    // THEN
    assertEquals("Hello world", interpreted);
}
Also used : ShellServer(org.neo4j.shell.ShellServer) Replacer(org.neo4j.shell.impl.BashVariableInterpreter.Replacer) ShellException(org.neo4j.shell.ShellException) Session(org.neo4j.shell.Session) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Session (org.neo4j.shell.Session)1 ShellException (org.neo4j.shell.ShellException)1 ShellServer (org.neo4j.shell.ShellServer)1 Replacer (org.neo4j.shell.impl.BashVariableInterpreter.Replacer)1