Skip to content

Commit b007b12

Browse files
committed
Disable problematic test cases on newer JREs on CI.
Certain parts of Mockito operate differently between Java 8 and later versions of Java. To minimize interference, disable a couple test cases that aren't required to verify interoperability with later versions of Java. Related: #2934.
1 parent ea8c911 commit b007b12

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/test/java/org/springframework/data/jpa/convert/QueryByExamplePredicateBuilderUnitTests.java

+17-17
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@
3939

4040
import org.junit.jupiter.api.BeforeEach;
4141
import org.junit.jupiter.api.Test;
42+
import org.junit.jupiter.api.condition.DisabledOnJre;
43+
import org.junit.jupiter.api.condition.JRE;
4244
import org.junit.jupiter.api.extension.ExtendWith;
4345
import org.mockito.ArgumentMatchers;
4446
import org.mockito.Mock;
4547
import org.mockito.junit.jupiter.MockitoExtension;
4648
import org.mockito.junit.jupiter.MockitoSettings;
4749
import org.mockito.quality.Strictness;
48-
4950
import org.springframework.data.domain.Example;
5051
import org.springframework.data.domain.ExampleMatcher;
5152
import org.springframework.data.domain.ExampleMatcher.GenericPropertyMatcher;
@@ -90,19 +91,16 @@ class QueryByExamplePredicateBuilderUnitTests {
9091
void setUp() {
9192

9293
personIdAttribute = new SingularAttributeStub<>("id", PersistentAttributeType.BASIC, Long.class);
93-
personFirstnameAttribute = new SingularAttributeStub<>("firstname", PersistentAttributeType.BASIC,
94-
String.class);
94+
personFirstnameAttribute = new SingularAttributeStub<>("firstname", PersistentAttributeType.BASIC, String.class);
9595
personAgeAttribute = new SingularAttributeStub<>("age", PersistentAttributeType.BASIC, Long.class);
96-
personFatherAttribute = new SingularAttributeStub<>("father", PersistentAttributeType.MANY_TO_ONE,
97-
Person.class, personEntityType);
98-
personSkillAttribute = new SingularAttributeStub<>("skill", PersistentAttributeType.EMBEDDED,
99-
Skill.class, skillEntityType);
100-
personAddressAttribute = new SingularAttributeStub<>("address", PersistentAttributeType.EMBEDDED,
101-
Address.class);
102-
skillNameAttribute = new SingularAttributeStub<>("name", PersistentAttributeType.BASIC,
103-
String.class);
104-
skillNestedAttribute = new SingularAttributeStub<>("nested", PersistentAttributeType.MANY_TO_ONE,
105-
Skill.class, skillEntityType);
96+
personFatherAttribute = new SingularAttributeStub<>("father", PersistentAttributeType.MANY_TO_ONE, Person.class,
97+
personEntityType);
98+
personSkillAttribute = new SingularAttributeStub<>("skill", PersistentAttributeType.EMBEDDED, Skill.class,
99+
skillEntityType);
100+
personAddressAttribute = new SingularAttributeStub<>("address", PersistentAttributeType.EMBEDDED, Address.class);
101+
skillNameAttribute = new SingularAttributeStub<>("name", PersistentAttributeType.BASIC, String.class);
102+
skillNestedAttribute = new SingularAttributeStub<>("nested", PersistentAttributeType.MANY_TO_ONE, Skill.class,
103+
skillEntityType);
106104

107105
personEntityAttribtues = new LinkedHashSet<>();
108106
personEntityAttribtues.add(personIdAttribute);
@@ -169,6 +167,7 @@ void singleElementCriteriaShouldJustReturnIt() {
169167
verify(cb, times(1)).equal(any(Expression.class), eq("foo"));
170168
}
171169

170+
@DisabledOnJre({ JRE.JAVA_11, JRE.JAVA_17 })
172171
@Test // DATAJPA-218
173172
void multiPredicateCriteriaShouldReturnCombinedOnes() {
174173

@@ -183,6 +182,7 @@ void multiPredicateCriteriaShouldReturnCombinedOnes() {
183182
verify(cb, times(1)).equal(any(Expression.class), eq(2L));
184183
}
185184

185+
@DisabledOnJre({ JRE.JAVA_11, JRE.JAVA_17 })
186186
@Test // DATAJPA-879
187187
void orConcatenatesPredicatesIfMatcherSpecifies() {
188188

@@ -306,13 +306,13 @@ static class SingularAttributeStub<X, T> implements SingularAttribute<X, T> {
306306
private Class<T> javaType;
307307
private Type<T> type;
308308

309-
SingularAttributeStub(String name,
310-
javax.persistence.metamodel.Attribute.PersistentAttributeType attributeType, Class<T> javaType) {
309+
SingularAttributeStub(String name, javax.persistence.metamodel.Attribute.PersistentAttributeType attributeType,
310+
Class<T> javaType) {
311311
this(name, attributeType, javaType, null);
312312
}
313313

314-
SingularAttributeStub(String name,
315-
javax.persistence.metamodel.Attribute.PersistentAttributeType attributeType, Class<T> javaType, Type<T> type) {
314+
SingularAttributeStub(String name, javax.persistence.metamodel.Attribute.PersistentAttributeType attributeType,
315+
Class<T> javaType, Type<T> type) {
316316
this.name = name;
317317
this.attributeType = attributeType;
318318
this.javaType = javaType;

0 commit comments

Comments
 (0)