@Test void runQueryTest() { EvoSQL evoSQL = Mockito.mock(EvoSQL.class); EvoSQLFactory evoSQLFactory = Mockito.mock(EvoSQLFactory.class); Mockito.when(evoSQLFactory.createEvoSQL(Mockito.any())).thenReturn(evoSQL); Result result = new Result("Select * From all;", 0); Mockito.when(evoSQL.execute(Mockito.anyString())).thenReturn(result); ConnectionData connectionData = new ConnectionData("cs", "db", "user", "pass"); EvoSQLRunner evoSQLRunner = new EvoSQLRunner(); evoSQLRunner.setEvoSQLFactory(evoSQLFactory); evoSQLRunner.runQuery("Select * From all;", connectionData); Mockito.verify(evoSQLFactory, Mockito.times(1)).createEvoSQL(connectionData); Mockito.verify(evoSQL, Mockito.times(1)).execute("Select * From all;"); }
@Override public Result runQuery(@NonNull String sqlQuery, @NonNull ConnectionData connectionData) { EvoSQL evoSQL = evoSQLFactory.createEvoSQL(connectionData); nl.tudelft.serg.evosql.Result evoSQLResult = evoSQL.execute(sqlQuery); return convertResult(evoSQLResult); }
EvoSQLRunner implements QueryRunner { @Override public Result runQuery(@NonNull String sqlQuery, @NonNull ConnectionData connectionData) { EvoSQL evoSQL = evoSQLFactory.createEvoSQL(connectionData); nl.tudelft.serg.evosql.Result evoSQLResult = evoSQL.execute(sqlQuery); return convertResult(evoSQLResult); } }
EvoSQLRunner implements QueryRunner { @Override public Result runQuery(@NonNull String sqlQuery, @NonNull ConnectionData connectionData) { EvoSQL evoSQL = evoSQLFactory.createEvoSQL(connectionData); nl.tudelft.serg.evosql.Result evoSQLResult = evoSQL.execute(sqlQuery); return convertResult(evoSQLResult); }  }
EvoSQLRunner implements QueryRunner { @Override public Result runQuery(@NonNull String sqlQuery, @NonNull ConnectionData connectionData) { EvoSQL evoSQL = evoSQLFactory.createEvoSQL(connectionData); nl.tudelft.serg.evosql.Result evoSQLResult = evoSQL.execute(sqlQuery); return convertResult(evoSQLResult); }  @Override Result runQuery(@NonNull String sqlQuery, @NonNull ConnectionData connectionData); }
EvoSQLRunner implements QueryRunner { @Override public Result runQuery(@NonNull String sqlQuery, @NonNull ConnectionData connectionData) { EvoSQL evoSQL = evoSQLFactory.createEvoSQL(connectionData); nl.tudelft.serg.evosql.Result evoSQLResult = evoSQL.execute(sqlQuery); return convertResult(evoSQLResult); }  @Override Result runQuery(@NonNull String sqlQuery, @NonNull ConnectionData connectionData);  }