assertj-db icon indicating copy to clipboard operation
assertj-db copied to clipboard

Add assertions to compare a table with another or a request to another

Open regis1512 opened this issue 9 years ago • 2 comments

The idea is to have an assertion like :

assertThat(table).isEqualTo(anotherTable);

regis1512 avatar Apr 06 '16 18:04 regis1512

Upvoting. Would be really good to have the same for Request as well

JustAlexOne avatar Sep 03 '20 15:09 JustAlexOne

Would also really like that.

Currently I'm converting the tables into list of maps as a workaround:

      List <Map <String, Object>> expected = vmUserTable.getRowsList ()
                                                        .stream ()
                                                        .map (row -> row.getValuesList ()
                                                                        .stream ()
                                                                        .filter (v -> v.getValue () != null)
                                                                        .collect (Collectors.toMap (Value::getColumnName, Value::getValue)))
                                                        .collect (Collectors.toList ());
      List <Map <String, Object>> actual = dynUserTable.getRowsList ()
                                                       .stream ()
                                                       .map (row -> row.getValuesList ()
                                                                       .stream ()
                                                                       .filter (v -> v.getValue () != null)
                                                                       .collect (Collectors.toMap (Value::getColumnName, Value::getValue)))
                                                       .collect (Collectors.toList ());
      assertThat (actual).isEqualTo (expected);

tisoft avatar Mar 31 '21 09:03 tisoft