@Test public void testInsertUrlSuccessful() throws MalformedURLException { String googleString = "http://www.google.com"; URL googleUrl = new URL(googleString); handle.createUpdate("INSERT INTO foo VALUES (:url)") .bind("url", googleUrl) .execute(); URL actualUrl = handle.createQuery("SELECT url FROM foo").mapTo(URL.class).findOnly(); Assertions.assertThat(actualUrl).hasToString(googleUrl.toString()); }
@Test public void testInsertUrlUsingBindByType() throws MalformedURLException { URL githubUrl = new URL("http://www.github.com"); handle.createUpdate("INSERT INTO foo VALUES (:url)") .bindByType("url", githubUrl, URL.class) .execute(); URL dbUrl = handle.createQuery("SELECT * FROM foo").mapTo(URL.class).findOnly(); Assertions.assertThat(dbUrl).hasToString(githubUrl.toString()); }