use of com.github.fabriciofx.cactoos.jdbc.session.Logged in project cactoos-jdbc by fabriciofx.
the class LoggedTest method loggedUpdate.
@Test
public void loggedUpdate() throws Exception {
final Logger logger = new LoggerFake();
final String sql = "CREATE TABLE t012 (id INT AUTO_INCREMENT, name VARCHAR(50))";
final Session session = new Logged(new SessionNoAuth(new SourceH2("testdb")), "cactoos-jdbc", logger);
new StatementUpdate(session, new QuerySimple(sql)).result();
MatcherAssert.assertThat("Can't connection from cactoos-jdbc", logger.toString(), Matchers.allOf(Matchers.containsString("Connection[#0] has been opened with properties"), Matchers.containsString(String.format("PreparedStatement[#0] created using SQL '%s'", sql)), Matchers.containsString("PreparedStatement[#0] updated a source and returned '0' in"), Matchers.containsString("PreparedStatement[#0] closed"), Matchers.containsString("Connection[#0] closed")));
}
Aggregations