code: @Then("^table '(.+?)' exists$")
      public void checkTable(String tableName) throws Exception {
          Statement myStatement = null;
          Connection myConnection = this.commonspec.getConnection();
  
          //query checks table existence, existence table name in system table  pg_tables
          String query = "SELECT * FROM pg_tables WHERE tablename = " + "\'" + tableName + "\'" + ";";
          try {
              myStatement = myConnection.createStatement();
              java.sql.ResultSet rs = myStatement.executeQuery(query);
              //if there are no data row
              if (rs.next() == false) {
                  Assertions.assertThat(rs.next()).as("there are no table " + tableName).isTrue();
              } else {
                  //data exist
                  String resultTableName = rs.getString(2);
                  assertThat(resultTableName).as("there are incorrect table name " + tableName).contains(tableName);
              }
              rs.close();
              myStatement.close();
          } catch (Exception e) {
              e.printStackTrace();
          }
  
      }
docs: /*
  @param table
  checks table existence