code: @Then("^I check that table '(.+?)' is iqual to$")
      public void comparetable(String tableName, DataTable dataTable) throws Exception {
          Statement myStatement = null;
          java.sql.ResultSet rs = null;
  
          //from postgres table
          List<String> sqlTable = new ArrayList<String>();
          List<String> sqlTableAux = new ArrayList<String>();
          //from Cucumber Datatable
          List<String> tablePattern = new ArrayList<String>();
          //comparison is by lists of string
          tablePattern = dataTable.asList(String.class);
  
  
          Connection myConnection = this.commonspec.getConnection();
          String query = "SELECT * FROM " + tableName + " order by " + "id" + ";";
          try {
              myStatement = myConnection.createStatement();
              rs = myStatement.executeQuery(query);
  
              //takes column names and culumn count
              ResultSetMetaData resultSetMetaData = rs.getMetaData();
              int count = resultSetMetaData.getColumnCount();
              for (int i = 1; i <= count; i++) {
                  sqlTable.add(resultSetMetaData.getColumnName(i).toString());
              }
  
              //takes column names and culumn count
              while (rs.next()) {
                  for (int i = 1; i <= count; i++) {
                      //aux list without column names
                      sqlTableAux.add(rs.getObject(i).toString());
                  }
              }
              sqlTable.addAll(sqlTableAux);
  
              assertThat(sqlTable).as("Not equal elements!").isEqualTo(tablePattern);
              rs.close();
              myStatement.close();
          } catch (Exception e) {
              e.printStackTrace();
              assertThat(rs).as("There are no table " + tableName).isNotNull();
          }
      }
docs: /*
  @param tableName
  @param dataTable
  compares two tables: pattern table and the result from remote database
  by default: order by id