use of org.neo4j.graphdb.Notification in project neo4j by neo4j.
the class ExecutionResultSerializerTest method shouldNotReturnPositionWhenEmptyPosition.
@Test
void shouldNotReturnPositionWhenEmptyPosition() {
// given
var row = Map.of("column1", "value1", "column2", "value2");
Notification notification = NotificationCode.CARTESIAN_PRODUCT.notification(InputPosition.empty);
List<Notification> notifications = Collections.singletonList(notification);
// when
writeStatementStart(serializer, "column1", "column2");
writeRecord(serializer, row, "column1", "column2");
writeStatementEnd(serializer, null, notifications);
writeTransactionInfo(serializer, "commit/uri/1");
// then
String result = output.toString(UTF_8);
assertEquals("{\"results\":[{\"columns\":[\"column1\",\"column2\"]," + "\"data\":[{\"row\":[\"value1\",\"value2\"],\"meta\":[null,null]}]}],\"notifications\":[{\"code\":\"Neo" + ".ClientNotification.Statement.CartesianProductWarning\",\"severity\":\"WARNING\",\"title\":\"This " + "query builds a cartesian product between disconnected patterns.\",\"description\":\"If a " + "part of a query contains multiple disconnected patterns, this will build a cartesian product" + " between all those parts. This may produce a large amount of data and slow down query " + "processing. While occasionally intended, it may often be possible to reformulate the query " + "that avoids the use of this cross product, perhaps by adding a relationship between the " + "different parts or by using OPTIONAL MATCH\"}],\"errors\":[],\"commit\":\"commit/uri/1\"}", result);
}
Aggregations