H2 extends DatabaseClient { public static H2Builder builder() { return new H2Builder(); } private  H2(Builder builder); @Override String[] getDropDdl(); @Override String getSelectConnectionIdsSql(); @Override String getKillConnectionSql(String connectionId); static H2Builder builder(); @Override String getDialect();  }
@Test public void createDdl_is_not_defined() { H2 h2 = H2.builder().build(); assertThat(h2.getCreateDdl()).isEmpty(); }
@Test public void shouldSetPortProperty() { H2 h2 = H2.builder().build(); assertThat(h2.getUrl()).matches("jdbc:h2:tcp: assertThat(h2.getAdditionalProperties().get("sonar.embeddedDatabase.port")).isNotEmpty(); }
@Test public void shouldSetPortPropertyWhenChangingUrl() { H2 h2 = H2.builder().setUrl("jdbc:h2:tcp: assertThat(h2.getUrl()).isEqualTo("jdbc:h2:tcp: assertThat(h2.getAdditionalProperties().get("sonar.embeddedDatabase.port")).isEqualTo("1234"); }
@Test public void driver_and_schema_must_not_be_set() { H2 h2 = H2.builder().setSchema("foo").setDriverFile(new File(".")).build(); assertThat(h2.getSchema()).isNull(); assertThat(h2.getDriverFile()).isNull(); }