use of org.neo4j.shell.prettyprint.LinePrinter in project neo4j by neo4j.
the class CypherShellTest method executeShouldPrintResult.
@Test
public void executeShouldPrintResult() throws CommandException {
Driver mockedDriver = mock(Driver.class);
Session session = mock(Session.class);
BoltResult result = mock(ListBoltResult.class);
BoltStateHandler boltStateHandler = mock(BoltStateHandler.class);
when(boltStateHandler.isConnected()).thenReturn(true);
when(boltStateHandler.runCypher(anyString(), anyMap())).thenReturn(Optional.of(result));
doAnswer(a -> {
((LinePrinter) a.getArguments()[1]).printOut("999");
return null;
}).when(mockedPrettyPrinter).format(any(BoltResult.class), anyObject());
when(mockedDriver.session()).thenReturn(session);
OfflineTestShell shell = new OfflineTestShell(logger, boltStateHandler, mockedPrettyPrinter);
shell.execute("RETURN 999");
verify(logger).printOut(contains("999"));
}
Aggregations