-
Notifications
You must be signed in to change notification settings - Fork 1
Database connection
Lukas Cardot edited this page Feb 16, 2020
·
1 revision
To specify on which database the assertion will be made you can define a specific connection. If you use the same database for several assertions, you should use the Builder to avoid too many connections on the same database.
assertThatQuery("SELECT id, code, label FROM table_test")
.using(DriverManager.getConnection("jdbc://localhost:5432/database-name", "username", "password"))
.isValidAgainst(loadFile("table_currency_expected.json"));
CQL:
assertThatCollection("select * from cassandra_table_type")
.using(new CassandraDataSource("cassandra_dc_test", "localhost", 5425))
.isValidAgainst(loadFile("table_currency_expected.json"));
Query Builder:
assertThatCollection(QueryBuilder.selectFrom("cassandratest", "cassandra_table_type").all())
.using(new CassandraDataSource("cassandra_dc_test", "localhost", 5425))
.isValidAgainst(loadFile("table_currency_expected.json"));