DATACMNS-973 - Migrate ticket references in test code to Spring Framework style.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,27 +43,18 @@ import com.querydsl.core.types.dsl.StringPath;
|
||||
*/
|
||||
public class QSortUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-402
|
||||
public void shouldThrowIfNoOrderSpecifiersAreGiven() {
|
||||
new QSort();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-402
|
||||
public void shouldThrowIfNullIsGiven() {
|
||||
new QSort((List<OrderSpecifier<?>>) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void sortBySingleProperty() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -74,11 +65,8 @@ public class QSortUnitTests {
|
||||
assertThat(qsort.getOrderFor("firstname"), is(new Sort.Order(Sort.Direction.ASC, "firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void sortByMultiplyProperties() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -91,11 +79,8 @@ public class QSortUnitTests {
|
||||
assertThat(qsort.getOrderFor("lastname"), is(new Sort.Order(Sort.Direction.DESC, "lastname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void sortByMultiplyPropertiesWithAnd() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -108,11 +93,8 @@ public class QSortUnitTests {
|
||||
assertThat(qsort.getOrderFor("lastname"), is(new Sort.Order(Sort.Direction.DESC, "lastname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void sortByMultiplyPropertiesWithAndAndVarArgs() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -125,10 +107,7 @@ public class QSortUnitTests {
|
||||
assertThat(qsort.getOrderFor("lastname"), is(new Sort.Order(Sort.Direction.DESC, "lastname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void ensureInteroperabilityWithSort() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -140,10 +119,7 @@ public class QSortUnitTests {
|
||||
assertThat(sort.getOrderFor("lastname"), is(new Sort.Order(Sort.Direction.DESC, "lastname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-402
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-402
|
||||
public void concatenatesPlainSortCorrectly() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -154,10 +130,7 @@ public class QSortUnitTests {
|
||||
assertThat(result, hasItems(new Order(Direction.ASC, "lastname"), new Order(Direction.ASC, "firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-566
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-566
|
||||
public void shouldSupportSortByOperatorExpressions() {
|
||||
|
||||
QUser user = QUser.user;
|
||||
@@ -169,10 +142,7 @@ public class QSortUnitTests {
|
||||
new Order(Direction.ASC, user.dateOfBirth.yearMonth().toString())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-621
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-621
|
||||
public void shouldCreateSortForNestedPathCorrectly() {
|
||||
|
||||
QSort sort = new QSort(userWrapper.user.firstname.asc());
|
||||
@@ -180,10 +150,7 @@ public class QSortUnitTests {
|
||||
assertThat(sort, hasItems(new Order(Direction.ASC, "user.firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-621
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-621
|
||||
public void shouldCreateSortForDeepNestedPathCorrectly() {
|
||||
|
||||
QSort sort = new QSort(wrapperForUserWrapper.wrapper.user.firstname.asc());
|
||||
@@ -191,10 +158,7 @@ public class QSortUnitTests {
|
||||
assertThat(sort, hasItems(new Order(Direction.ASC, "wrapper.user.firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-621
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-621
|
||||
public void shouldCreateSortForReallyDeepNestedPathCorrectly() {
|
||||
|
||||
QSort sort = new QSort(wrapperToWrapWrapperForUserWrapper.wrapperForUserWrapper.wrapper.user.firstname.asc());
|
||||
@@ -202,10 +166,7 @@ public class QSortUnitTests {
|
||||
assertThat(sort, hasItems(new Order(Direction.ASC, "wrapperForUserWrapper.wrapper.user.firstname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-755
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-755
|
||||
public void handlesPlainStringPathsCorrectly() {
|
||||
|
||||
StringPath path = new PathBuilderFactory().create(User.class).getString("firstname");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,18 +28,12 @@ import org.junit.Test;
|
||||
*/
|
||||
public class QueryDslUtilsUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-883
|
||||
public void rendersDotPathForPathTraversalContainingAnyExpression() {
|
||||
assertThat(toDotPath(QUser.user.addresses.any().street), is("addresses.street"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-941
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-941
|
||||
public void skipsIntermediateDelegates() {
|
||||
|
||||
assertThat(toDotPath(QUser.user.as(QSpecialUser.class).as(QSpecialUser.class).specialProperty),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,10 +55,7 @@ public class QuerydslRepositoryInvokerAdapterUnitTests {
|
||||
this.adapter = new QuerydslRepositoryInvokerAdapter(delegate, executor, predicate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void forwardsFindAllToExecutorWithPredicate() {
|
||||
|
||||
Sort sort = new Sort("firstname");
|
||||
@@ -68,10 +65,7 @@ public class QuerydslRepositoryInvokerAdapterUnitTests {
|
||||
verify(delegate, times(0)).invokeFindAll(sort);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void forwardsFindAllWithPageableToExecutorWithPredicate() {
|
||||
|
||||
PageRequest pageable = new PageRequest(0, 10);
|
||||
@@ -81,10 +75,7 @@ public class QuerydslRepositoryInvokerAdapterUnitTests {
|
||||
verify(delegate, times(0)).invokeFindAll(pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
||||
public void forwardsMethodsToDelegate() {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -58,10 +58,7 @@ public class QuerydslBindingsFactoryUnitTests {
|
||||
this.factory = new QuerydslBindingsFactory(SimpleEntityPathResolver.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void createBindingsShouldHonorQuerydslBinderCustomizerHookWhenPresent() {
|
||||
|
||||
@@ -81,10 +78,7 @@ public class QuerydslBindingsFactoryUnitTests {
|
||||
is((Predicate) QUser.user.firstname.contains("rand")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void shouldReuseExistingQuerydslBinderCustomizer() {
|
||||
|
||||
@@ -102,10 +96,7 @@ public class QuerydslBindingsFactoryUnitTests {
|
||||
is((Predicate) QUser.user.firstname.eq("RAND")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void rejectsPredicateResolutionIfDomainTypeCantBeAutoDetected() {
|
||||
|
||||
exception.expect(IllegalStateException.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -58,18 +58,12 @@ public class QuerydslBindingsUnitTests {
|
||||
this.bindings = new QuerydslBindings();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
|
||||
public void rejectsNullPath() {
|
||||
bindings.getBindingForPath(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void returnsNullIfNoBindingRegisteredForPath() {
|
||||
|
||||
PathInformation path = PropertyPathInformation.of("lastname", User.class);
|
||||
@@ -77,10 +71,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.getBindingForPath(path), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void returnsRegisteredBindingForSimplePath() {
|
||||
|
||||
bindings.bind(QUser.user.firstname).first(CONTAINS_BINDING);
|
||||
@@ -90,10 +81,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertAdapterWithTargetBinding(bindings.getBindingForPath(path), CONTAINS_BINDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void getBindingForPathShouldReturnSpeficicBindingForNestedElementsWhenAvailable() {
|
||||
|
||||
bindings.bind(QUser.user.address.street).first(CONTAINS_BINDING);
|
||||
@@ -103,10 +91,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertAdapterWithTargetBinding(bindings.getBindingForPath(path), CONTAINS_BINDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void getBindingForPathShouldReturnSpeficicBindingForTypes() {
|
||||
|
||||
bindings.bind(String.class).first(CONTAINS_BINDING);
|
||||
@@ -116,10 +101,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertAdapterWithTargetBinding(bindings.getBindingForPath(path), CONTAINS_BINDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void propertyNotExplicitlyIncludedAndWithoutTypeBindingIsInvisible() {
|
||||
|
||||
bindings.bind(String.class).first(CONTAINS_BINDING);
|
||||
@@ -129,10 +111,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.getBindingForPath(path), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void pathIsVisibleIfTypeBasedBindingWasRegistered() {
|
||||
|
||||
bindings.bind(String.class).first(CONTAINS_BINDING);
|
||||
@@ -140,10 +119,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("inceptionYear", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void explicitlyIncludedPathIsVisible() {
|
||||
|
||||
bindings.including(QUser.user.inceptionYear);
|
||||
@@ -151,10 +127,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("inceptionYear", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void notExplicitlyIncludedPathIsInvisible() {
|
||||
|
||||
bindings.including(QUser.user.inceptionYear);
|
||||
@@ -162,10 +135,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("firstname", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void excludedPathIsInvisible() {
|
||||
|
||||
bindings.excluding(QUser.user.inceptionYear);
|
||||
@@ -173,10 +143,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("inceptionYear", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void pathIsVisibleIfNotExplicitlyExcluded() {
|
||||
|
||||
bindings.excluding(QUser.user.inceptionYear);
|
||||
@@ -184,10 +151,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("firstname", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void pathIsVisibleIfItsBothBlackAndWhitelisted() {
|
||||
|
||||
bindings.excluding(QUser.user.firstname);
|
||||
@@ -196,10 +160,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("firstname", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void nestedPathIsInvisibleIfAParanetPathWasExcluded() {
|
||||
|
||||
bindings.excluding(QUser.user.address);
|
||||
@@ -207,10 +168,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.city", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void pathIsVisibleIfConcretePathIsVisibleButParentExcluded() {
|
||||
|
||||
bindings.excluding(QUser.user.address);
|
||||
@@ -219,10 +177,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.city", User.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void isPathVisibleShouldReturnFalseWhenPartialPathContainedInExcludingAndConcretePathToDifferentPropertyIsIncluded() {
|
||||
|
||||
bindings.excluding(QUser.user.address);
|
||||
@@ -231,10 +186,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.street", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void whitelistsPropertiesCorrectly() {
|
||||
|
||||
bindings.including(QUser.user.firstname, QUser.user.address.street);
|
||||
@@ -245,26 +197,17 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.city", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-787
|
||||
public void rejectsNullAlias() {
|
||||
bindings.bind(QUser.user.address).as(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-787
|
||||
public void rejectsEmptyAlias() {
|
||||
bindings.bind(QUser.user.address).as("");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-787
|
||||
public void aliasesBinding() {
|
||||
|
||||
bindings.bind(QUser.user.address.city).as("city").first(CONTAINS_BINDING);
|
||||
@@ -278,10 +221,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(bindings.isPathAvailable("address.city", User.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-787
|
||||
public void explicitlyIncludesOriginalBindingDespiteAlias() {
|
||||
|
||||
bindings.including(QUser.user.address.city);
|
||||
@@ -300,10 +240,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertAdapterWithTargetBinding(bindings.getBindingForPath(propertyPath), CONTAINS_BINDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-787
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-787
|
||||
public void registedAliasWithNullBinding() {
|
||||
|
||||
bindings.bind(QUser.user.address.city).as("city").withDefaultBinding();
|
||||
@@ -315,10 +252,7 @@ public class QuerydslBindingsUnitTests {
|
||||
assertThat(binding, is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-941
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-941
|
||||
public void registersBindingForPropertyOfSubtype() {
|
||||
|
||||
bindings.bind(QUser.user.as(QSpecialUser.class).specialProperty).first(ContainsBinding.INSTANCE);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,10 +44,7 @@ public class QuerydslDefaultBindingUnitTests {
|
||||
binding = new QuerydslDefaultBinding();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void shouldCreatePredicateCorrectlyWhenPropertyIsInRoot() {
|
||||
|
||||
Predicate predicate = binding.bind(QUser.user.firstname, Collections.singleton("tam"));
|
||||
@@ -55,10 +52,7 @@ public class QuerydslDefaultBindingUnitTests {
|
||||
assertPredicate(predicate, is(QUser.user.firstname.eq("tam")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void shouldCreatePredicateCorrectlyWhenPropertyIsInNestedElement() {
|
||||
|
||||
Predicate predicate = binding.bind(QUser.user.address.city, Collections.singleton("two rivers"));
|
||||
@@ -66,10 +60,7 @@ public class QuerydslDefaultBindingUnitTests {
|
||||
Assert.assertThat(predicate.toString(), is(QUser.user.address.city.eq("two rivers").toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void shouldCreatePredicateWithContainingWhenPropertyIsCollectionLikeAndValueIsObject() {
|
||||
|
||||
Predicate predicate = binding.bind(QUser.user.nickNames, Collections.singleton("dragon reborn"));
|
||||
@@ -77,10 +68,7 @@ public class QuerydslDefaultBindingUnitTests {
|
||||
assertPredicate(predicate, is(QUser.user.nickNames.contains("dragon reborn")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void shouldCreatePredicateWithInWhenPropertyIsAnObjectAndValueIsACollection() {
|
||||
|
||||
Predicate predicate = binding.bind(QUser.user.firstname, Arrays.asList("dragon reborn", "shadowkiller"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,35 +64,23 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
this.values = new LinkedMultiValueMap<String, String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
|
||||
public void rejectsNullConversionService() {
|
||||
new QuerydslPredicateBuilder(null, SimpleEntityPathResolver.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-669
|
||||
public void getPredicateShouldThrowErrorWhenBindingContextIsNull() {
|
||||
builder.getPredicate(null, values, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void getPredicateShouldReturnEmptyPredicateWhenPropertiesAreEmpty() {
|
||||
|
||||
assertThat(builder.getPredicate(ClassTypeInformation.OBJECT, values, DEFAULT_BINDINGS), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void resolveArgumentShouldCreateSingleStringParameterPredicateCorrectly() throws Exception {
|
||||
|
||||
values.add("firstname", "Oliver");
|
||||
@@ -107,10 +95,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(result, hasItem(Users.OLIVER));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void resolveArgumentShouldCreateNestedStringParameterPredicateCorrectly() throws Exception {
|
||||
|
||||
values.add("address.city", "Linz");
|
||||
@@ -125,10 +110,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(result, hasItem(Users.CHRISTOPH));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void ignoresNonDomainTypeProperties() {
|
||||
|
||||
values.add("firstname", "rand");
|
||||
@@ -139,10 +121,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(predicate, is((Predicate) QUser.user.firstname.eq("rand")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-669
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-669
|
||||
public void forwardsNullForEmptyParameterToSingleValueBinder() {
|
||||
|
||||
values.add("lastname", null);
|
||||
@@ -159,10 +138,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
builder.getPredicate(USER_TYPE, values, bindings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-734
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-734
|
||||
@SuppressWarnings("unchecked")
|
||||
public void resolvesCommaSeparatedArgumentToArrayCorrectly() {
|
||||
|
||||
@@ -176,10 +152,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat((Double[]) (constant.getConstant()), arrayContaining(40.740337D, -73.995146D));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-734
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-734
|
||||
@SuppressWarnings("unchecked")
|
||||
public void leavesCommaSeparatedArgumentUntouchedWhenTargetIsNotAnArray() {
|
||||
|
||||
@@ -193,10 +166,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat((String) (constant.getConstant()), equalTo("rivers,two"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-734
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-734
|
||||
public void bindsDateCorrectly() throws ParseException {
|
||||
|
||||
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd");
|
||||
@@ -209,10 +179,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(predicate, is((Predicate) QUser.user.dateOfBirth.eq(format.parseDateTime(date).toDate())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-883
|
||||
public void automaticallyInsertsAnyStepInCollectionReference() {
|
||||
|
||||
values.add("addresses.street", "VALUE");
|
||||
@@ -222,10 +189,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(predicate, is((Predicate) QUser.user.addresses.any().street.eq("VALUE")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-941
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-941
|
||||
public void buildsPredicateForBindingUsingDowncast() {
|
||||
|
||||
values.add("specialProperty", "VALUE");
|
||||
@@ -239,10 +203,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
assertThat(predicate, is((Predicate) QUser.user.as(QSpecialUser.class).specialProperty.contains("VALUE")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-941
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-941
|
||||
public void buildsPredicateForBindingUsingNestedDowncast() {
|
||||
|
||||
values.add("user.specialProperty", "VALUE");
|
||||
|
||||
Reference in New Issue
Block a user