#373 - Polishing.

Using soft assertions for more expressive test failures.

Original pull request: #376.
This commit is contained in:
Jens Schauder
2020-07-22 14:13:22 +02:00
parent 9e116269fe
commit 06cc4e2701

View File

@@ -17,12 +17,14 @@ package org.springframework.data.r2dbc.repository.query;
import static org.assertj.core.api.Assertions.*;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
/**
* Unit tests for {@link ExpressionQuery}.
*
* @author Mark Paluch
* @author Jens Schauder
*/
public class ExpressionQueryUnitTests {
@@ -35,10 +37,13 @@ public class ExpressionQueryUnitTests {
assertThat(query.getQuery())
.isEqualTo("INSERT IGNORE INTO table (x, y) VALUES (:__synthetic_0__, :__synthetic_1__)");
assertThat(query.getBindings()).hasSize(2);
assertThat(query.getBindings().get(0).getExpression()).isEqualTo("#point.x");
assertThat(query.getBindings().get(0).getParameterName()).isEqualTo("__synthetic_0__");
assertThat(query.getBindings().get(1).getExpression()).isEqualTo("#point.y");
assertThat(query.getBindings().get(1).getParameterName()).isEqualTo("__synthetic_1__");
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(query.getBindings()).hasSize(2);
softly.assertThat(query.getBindings().get(0).getExpression()).isEqualTo("#point.x");
softly.assertThat(query.getBindings().get(0).getParameterName()).isEqualTo("__synthetic_0__");
softly.assertThat(query.getBindings().get(1).getExpression()).isEqualTo("#point.y");
softly.assertThat(query.getBindings().get(1).getParameterName()).isEqualTo("__synthetic_1__");
});
}
}