use of com.github.fabriciofx.cactoos.jdbc.Servers in project cactoos-jdbc by fabriciofx.
the class PhonebookTest method renameContact.
@Test
public void renameContact() throws Exception {
try (Servers servers = new Servers(new ServerH2(new ScriptSql(new ResourceOf(new Joined("/", "com/github/fabriciofx/cactoos/jdbc/phonebook", "phonebook-h2.sql")))), new ServerPgsql(new ScriptSql(new ResourceOf(new Joined("/", "com/github/fabriciofx/cactoos/jdbc/phonebook", "phonebook-pgsql.sql")))))) {
for (final Session session : servers.sessions()) {
final Phonebook phonebook = new PhonebookSql(session);
final Contact contact = phonebook.filter("maria").iterator().next();
contact.update(new MapOf<String, String>(new MapEntry<>("name", "Maria Lima")));
MatcherAssert.assertThat(XhtmlMatchers.xhtml(new PhonebookSql(session).filter("maria").iterator().next().about()), XhtmlMatchers.hasXPaths("/contact/name[text()='Maria Lima']"));
}
}
}
Aggregations