Search in sources :

Example 1 with UserMessagesHandler

use of org.neo4j.shell.UserMessagesHandler in project neo4j by neo4j.

the class InteractiveShellRunnerTest method setup.

@Before
public void setup() throws Exception {
    statementParser = new ShellStatementParser();
    logger = mock(Logger.class);
    cmdExecuter = mock(StatementExecuter.class);
    txHandler = mock(TransactionHandler.class);
    databaseManager = mock(DatabaseManager.class);
    connectionConfig = mock(ConnectionConfig.class);
    historyFile = temp.newFile();
    badLineError = new ClientException("Found a bad line");
    userMessagesHandler = mock(UserMessagesHandler.class);
    when(databaseManager.getActualDatabaseAsReportedByServer()).thenReturn("mydb");
    when(userMessagesHandler.getWelcomeMessage()).thenReturn("Welcome to cypher-shell!");
    when(userMessagesHandler.getExitMessage()).thenReturn("Exit message");
    when(connectionConfig.username()).thenReturn("myusername");
    doThrow(badLineError).when(cmdExecuter).execute(contains("bad"));
    doReturn(System.out).when(logger).getOutputStream();
}
Also used : ShellStatementParser(org.neo4j.shell.parser.ShellStatementParser) StatementExecuter(org.neo4j.shell.StatementExecuter) DatabaseManager(org.neo4j.shell.DatabaseManager) TransactionHandler(org.neo4j.shell.TransactionHandler) ClientException(org.neo4j.driver.exceptions.ClientException) Logger(org.neo4j.shell.log.Logger) AnsiLogger(org.neo4j.shell.log.AnsiLogger) ConnectionConfig(org.neo4j.shell.ConnectionConfig) UserMessagesHandler(org.neo4j.shell.UserMessagesHandler) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 ClientException (org.neo4j.driver.exceptions.ClientException)1 ConnectionConfig (org.neo4j.shell.ConnectionConfig)1 DatabaseManager (org.neo4j.shell.DatabaseManager)1 StatementExecuter (org.neo4j.shell.StatementExecuter)1 TransactionHandler (org.neo4j.shell.TransactionHandler)1 UserMessagesHandler (org.neo4j.shell.UserMessagesHandler)1 AnsiLogger (org.neo4j.shell.log.AnsiLogger)1 Logger (org.neo4j.shell.log.Logger)1 ShellStatementParser (org.neo4j.shell.parser.ShellStatementParser)1