Search in sources :

Example 6 with ParamValue

use of org.neo4j.shell.state.ParamValue in project neo4j by neo4j.

the class ParamsTest method runCommandWithArgWithExtraSpace.

@Test
public void runCommandWithArgWithExtraSpace() throws CommandException {
    // given
    vars.put("var", new ParamValue(String.valueOf(9), 9));
    vars.put("param", new ParamValue(String.valueOf(9999), 9999));
    // when
    cmd.execute(" var");
    // then
    verify(logger).printOut(":param var => 9");
    verifyNoMoreInteractions(logger);
}
Also used : ParamValue(org.neo4j.shell.state.ParamValue) Test(org.junit.Test)

Example 7 with ParamValue

use of org.neo4j.shell.state.ParamValue in project neo4j by neo4j.

the class ParamsTest method runCommandAlignment.

@Test
public void runCommandAlignment() throws CommandException {
    // given
    vars.put("var", new ParamValue(String.valueOf(9), 9));
    vars.put("param", new ParamValue(String.valueOf(99999), 99999));
    // when
    cmd.execute("");
    // then
    verify(logger).printOut(":param param => 99999");
    verify(logger).printOut(":param var   => 9");
    verifyNoMoreInteractions(logger);
}
Also used : ParamValue(org.neo4j.shell.state.ParamValue) Test(org.junit.Test)

Example 8 with ParamValue

use of org.neo4j.shell.state.ParamValue in project neo4j by neo4j.

the class ParamsTest method runCommand.

@Test
public void runCommand() throws CommandException {
    // given
    String var = "var";
    int value = 9;
    vars.put(var, new ParamValue(String.valueOf(value), value));
    // when
    cmd.execute("");
    // then
    verify(logger).printOut(":param var => 9");
    verifyNoMoreInteractions(logger);
}
Also used : ParamValue(org.neo4j.shell.state.ParamValue) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 9 with ParamValue

use of org.neo4j.shell.state.ParamValue in project neo4j by neo4j.

the class ParamsTest method runCommandWithArgWithBackticks.

@Test
public void runCommandWithArgWithBackticks() throws CommandException {
    // given
    vars.put("var", new ParamValue(String.valueOf(9), 9));
    vars.put("param", new ParamValue(String.valueOf(9999), 9999));
    // when
    cmd.execute("`var`");
    // then
    verify(logger).printOut(":param `var` => 9");
    verifyNoMoreInteractions(logger);
}
Also used : ParamValue(org.neo4j.shell.state.ParamValue) Test(org.junit.Test)

Aggregations

ParamValue (org.neo4j.shell.state.ParamValue)9 Test (org.junit.Test)8 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 EvaluationException (org.neo4j.cypher.internal.evaluator.EvaluationException)1 Cypher (org.neo4j.cypher.internal.parser.javacc.Cypher)1 CypherCharStream (org.neo4j.cypher.internal.parser.javacc.CypherCharStream)1 ParseException (org.neo4j.cypher.internal.parser.javacc.ParseException)1 ParameterException (org.neo4j.shell.exception.ParameterException)1