77import de .bytefish .pgbulkinsert .test .utils .TransactionalTestBase ;
88import de .bytefish .pgbulkinsert .util .PostgreSqlUtils ;
99import org .junit .Assert ;
10- import org .junit .Ignore ;
1110import org .junit .Test ;
1211
1312import java .sql .ResultSet ;
@@ -35,11 +34,12 @@ public void setCol_hstore(Map<String, String> col_hstore) {
3534
3635 @ Override
3736 protected void onSetUpInTransaction () throws Exception {
37+ installExtension ();
3838 createTable ();
3939 }
4040
4141 @ Override
42- protected void onSetUpBeforeTransaction () throws Exception {
42+ protected void onSetUpBeforeTransaction () {
4343
4444 }
4545
@@ -52,6 +52,14 @@ public HStoreEntityMapping() {
5252 }
5353 }
5454
55+ private boolean installExtension () throws SQLException {
56+ String sqlStatement = "CREATE EXTENSION IF NOT EXISTS hstore;" ;
57+
58+ Statement statement = connection .createStatement ();
59+
60+ return statement .execute (sqlStatement );
61+ }
62+
5563 private boolean createTable () throws SQLException {
5664 String sqlStatement = String .format ("CREATE TABLE %s.hstore_table(\n " , schema ) +
5765 " col_hstore hstore \n " +
@@ -63,7 +71,6 @@ private boolean createTable() throws SQLException {
6371 }
6472
6573 @ Test
66- @ Ignore ("This Test Requires the hstore extension to be enabled." )
6774 @ SuppressWarnings ("unchecked" )
6875 public void saveAll_Hstore_Test () throws SQLException {
6976
@@ -93,7 +100,7 @@ public void saveAll_Hstore_Test() throws SQLException {
93100 Map <String , String > v = (Map <String ,String >) rs .getObject ("col_hstore" );
94101
95102 Assert .assertEquals (1 , v .size ());
96- Assert .assertEquals ( true , v .containsKey ("Philipp" ));
103+ Assert .assertTrue ( v .containsKey ("Philipp" ));
97104 Assert .assertEquals ("Cool Cool Cool!" , v .get ("Philipp" ));
98105 }
99106 }
0 commit comments