assertj-db
assertj-db copied to clipboard
Add assertions to compare a table with another or a request to another
The idea is to have an assertion like :
assertThat(table).isEqualTo(anotherTable);
Upvoting. Would be really good to have the same for Request as well
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);