code: @When("^I query the database with '(.+?)'$")
      public void selectData(String query) throws Exception {
          Statement myStatement = null;
          //postgres table
          List<String> sqlTable = new ArrayList<String>();
          List<String> sqlTableAux = new ArrayList<String>();
          Connection myConnection = this.commonspec.getConnection();
          java.sql.ResultSet rs = null;
          try {
              myStatement = myConnection.createStatement();
              rs = myStatement.executeQuery(query);
              //column names
              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 column 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);
  
              //sends raws to environment variable
              for (int i = 0; i < sqlTable.size(); i++) {
                  ThreadProperty.set("queryresponse" + i, sqlTable.get(i));
              }
              ThreadProperty.remove("queryresponse" + sqlTable.size());
              rs.close();
              myStatement.close();
          } catch (Exception e) {
              e.printStackTrace();
              Assertions.assertThat(rs).as("There are no response from SELECT").isNotNull();
          }
      }
docs: /*
  @param query
  selects data from database
  and sends it to environment variable