DATACMNS-1554 - Polishing.
Replace AtTest(expected = …) and ExpectedException with the corresponding AssertJ assertThatExceptionOfType(…) and assertThatIllegalArgumentException().isThrownBy(…).
This commit is contained in:
@@ -23,6 +23,7 @@ import static org.springframework.data.querydsl.QQSortUnitTests_WrapperToWrapWra
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.data.domain.Sort.Order;
|
||||
@@ -41,9 +42,9 @@ import com.querydsl.core.types.dsl.StringPath;
|
||||
*/
|
||||
public class QSortUnitTests {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-402
|
||||
@Test // DATACMNS-402
|
||||
public void shouldThrowIfNullIsGiven() {
|
||||
new QSort((List<OrderSpecifier<?>>) null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new QSort((List<OrderSpecifier<?>>) null));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-402
|
||||
|
||||
@@ -41,9 +41,10 @@ public class SimpleEntityPathResolverUnitTests {
|
||||
assertThat(resolver.createPath(NamedUser.class)).isInstanceOf(QSimpleEntityPathResolverUnitTests_NamedUser.class);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsClassWithoutQueryClassConfrmingToTheNamingScheme() throws Exception {
|
||||
resolver.createPath(QSimpleEntityPathResolverUnitTests_Sample.class);
|
||||
@Test
|
||||
public void rejectsClassWithoutQueryClassConfrmingToTheNamingScheme() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> resolver.createPath(QSimpleEntityPathResolverUnitTests_Sample.class));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1235
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Optional;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.data.querydsl.QSpecialUser;
|
||||
import org.springframework.data.querydsl.QUser;
|
||||
@@ -52,9 +53,9 @@ public class QuerydslBindingsUnitTests {
|
||||
this.bindings = new QuerydslBindings();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
|
||||
@Test // DATACMNS-669
|
||||
public void rejectsNullPath() {
|
||||
bindings.getBindingForPath(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> bindings.getBindingForPath(null));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-669
|
||||
@@ -190,14 +191,14 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.city", User.class)).isFalse();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-787
|
||||
@Test // DATACMNS-787
|
||||
public void rejectsNullAlias() {
|
||||
bindings.bind(QUser.user.address).as(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> bindings.bind(QUser.user.address).as(null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-787
|
||||
@Test // DATACMNS-787
|
||||
public void rejectsEmptyAlias() {
|
||||
bindings.bind(QUser.user.address).as("");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> bindings.bind(QUser.user.address).as(""));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-787
|
||||
|
||||
@@ -63,14 +63,15 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
this.values = new LinkedMultiValueMap<>();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
|
||||
@Test // DATACMNS-669
|
||||
public void rejectsNullConversionService() {
|
||||
new QuerydslPredicateBuilder(null, SimpleEntityPathResolver.INSTANCE);
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new QuerydslPredicateBuilder(null, SimpleEntityPathResolver.INSTANCE));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
|
||||
@Test // DATACMNS-669
|
||||
public void getPredicateShouldThrowErrorWhenBindingContextIsNull() {
|
||||
builder.getPredicate(null, values, null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> builder.getPredicate(null, values, null));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-669, DATACMNS-1168
|
||||
|
||||
Reference in New Issue
Block a user