Skip to content

Commit 52a5e31

Browse files
committed
Polishing.
Move warning suppression to the class-level. See #3901
1 parent 1dcf910 commit 52a5e31

File tree

5 files changed

+6
-25
lines changed

5 files changed

+6
-25
lines changed

spring-data-jpa/src/test/java/org/springframework/data/jpa/convert/threeten/Jsr310JpaConvertersUnitTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
import static org.assertj.core.api.Assertions.*;
1919

20-
import java.util.Arrays;
21-
2220
import jakarta.persistence.AttributeConverter;
2321

22+
import java.util.Arrays;
23+
2424
import org.junit.jupiter.params.ParameterizedTest;
2525
import org.junit.jupiter.params.provider.MethodSource;
2626

@@ -40,7 +40,6 @@ static Iterable<?> data() {
4040
new Jsr310JpaConverters.ZoneIdConverter());
4141
}
4242

43-
4443
@ParameterizedTest
4544
@MethodSource("data")
4645
void convertersHandleNullValuesCorrectly(AttributeConverter<?, ?> converter) {

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/DeleteSpecificationUnitTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*
4040
* @author Mark Paluch
4141
*/
42-
@SuppressWarnings("serial")
42+
@SuppressWarnings({ "unchecked", "deprecation" })
4343
@ExtendWith(MockitoExtension.class)
4444
@MockitoSettings(strictness = Strictness.LENIENT)
4545
class DeleteSpecificationUnitTests implements Serializable {
@@ -109,7 +109,6 @@ void specificationsShouldBeSerializable() {
109109

110110
assertThat(specification).isNotNull();
111111

112-
@SuppressWarnings({"unchecked", "deprecation"})
113112
DeleteSpecification<Object> transferredSpecification = (DeleteSpecification<Object>) deserialize(
114113
serialize(specification));
115114

@@ -125,7 +124,6 @@ void complexSpecificationsShouldBeSerializable() {
125124

126125
assertThat(specification).isNotNull();
127126

128-
@SuppressWarnings({"unchecked", "deprecation"})
129127
DeleteSpecification<Object> transferredSpecification = (DeleteSpecification<Object>) deserialize(
130128
serialize(specification));
131129

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/PredicateSpecificationUnitTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
*
3939
* @author Mark Paluch
4040
*/
41-
@SuppressWarnings("serial")
41+
@SuppressWarnings({ "unchecked", "deprecation" })
4242
@ExtendWith(MockitoExtension.class)
4343
@MockitoSettings(strictness = Strictness.LENIENT)
4444
class PredicateSpecificationUnitTests implements Serializable {
@@ -107,7 +107,6 @@ void specificationsShouldBeSerializable() {
107107

108108
assertThat(specification).isNotNull();
109109

110-
@SuppressWarnings({"unchecked", "deprecation"})
111110
PredicateSpecification<Object> transferredSpecification = (PredicateSpecification<Object>) deserialize(
112111
serialize(specification));
113112

@@ -123,7 +122,6 @@ void complexSpecificationsShouldBeSerializable() {
123122

124123
assertThat(specification).isNotNull();
125124

126-
@SuppressWarnings({"unchecked", "deprecation"})
127125
PredicateSpecification<Object> transferredSpecification = (PredicateSpecification<Object>) deserialize(
128126
serialize(specification));
129127

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/SpecificationUnitTests.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import java.io.Serializable;
2828

29-
import org.junit.jupiter.api.BeforeEach;
3029
import org.junit.jupiter.api.Test;
3130
import org.junit.jupiter.api.extension.ExtendWith;
3231
import org.mockito.Mock;
@@ -44,24 +43,16 @@
4443
* @author Mark Paluch
4544
* @author Daniel Shuy
4645
*/
47-
@SuppressWarnings("removal")
46+
@SuppressWarnings({ "unchecked", "deprecation" })
4847
@ExtendWith(MockitoExtension.class)
4948
@MockitoSettings(strictness = Strictness.LENIENT)
5049
class SpecificationUnitTests {
5150

52-
private Specification<Object> spec;
5351
@Mock(serializable = true) Root<Object> root;
5452
@Mock(serializable = true) CriteriaQuery<?> query;
5553
@Mock(serializable = true) CriteriaBuilder builder;
56-
5754
@Mock(serializable = true) Predicate predicate;
5855

59-
@BeforeEach
60-
void setUp() {
61-
62-
spec = (root, query, cb) -> predicate;
63-
}
64-
6556
@Test // GH-1943
6657
void emptyAllOfReturnsEmptySpecification() {
6758

@@ -88,7 +79,6 @@ void specificationsShouldBeSerializable() {
8879

8980
assertThat(specification).isNotNull();
9081

91-
@SuppressWarnings({ "unchecked", "deprecation"})
9282
Specification<Object> transferredSpecification = (Specification<Object>) deserialize(serialize(specification));
9383

9484
assertThat(transferredSpecification).isNotNull();
@@ -103,7 +93,6 @@ void complexSpecificationsShouldBeSerializable() {
10393

10494
assertThat(specification).isNotNull();
10595

106-
@SuppressWarnings({ "unchecked", "deprecation"})
10796
Specification<Object> transferredSpecification = (Specification<Object>) deserialize(serialize(specification));
10897

10998
assertThat(transferredSpecification).isNotNull();
@@ -116,7 +105,6 @@ void andCombinesSpecificationsInOrder() {
116105
Predicate secondPredicate = mock(Predicate.class);
117106

118107
Specification<Object> first = ((root1, query1, criteriaBuilder) -> firstPredicate);
119-
120108
Specification<Object> second = ((root1, query1, criteriaBuilder) -> secondPredicate);
121109

122110
first.and(second).toPredicate(root, query, builder);

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/UpdateSpecificationUnitTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*
4040
* @author Mark Paluch
4141
*/
42-
@SuppressWarnings("serial")
42+
@SuppressWarnings({ "unchecked", "deprecation" })
4343
@ExtendWith(MockitoExtension.class)
4444
@MockitoSettings(strictness = Strictness.LENIENT)
4545
class UpdateSpecificationUnitTests implements Serializable {
@@ -109,7 +109,6 @@ void specificationsShouldBeSerializable() {
109109

110110
assertThat(specification).isNotNull();
111111

112-
@SuppressWarnings({"unchecked", "deprecation"})
113112
UpdateSpecification<Object> transferredSpecification = (UpdateSpecification<Object>) deserialize(
114113
serialize(specification));
115114

@@ -125,7 +124,6 @@ void complexSpecificationsShouldBeSerializable() {
125124

126125
assertThat(specification).isNotNull();
127126

128-
@SuppressWarnings({"unchecked", "deprecation"})
129127
UpdateSpecification<Object> transferredSpecification = (UpdateSpecification<Object>) deserialize(
130128
serialize(specification));
131129

0 commit comments

Comments
 (0)