Add Java 17 verification to CI pipeline.

Avoid usage of encapsulated tests as dummies. Add dependency override for ASM dependencies.

Replace Java 16 with Java 17 in CI pipeline.

Closes #2423
This commit is contained in:
Mark Paluch
2021-09-20 09:38:08 +02:00
parent 571cb36e31
commit bf3c9a5c6c
7 changed files with 38 additions and 19 deletions

View File

@@ -18,11 +18,13 @@ package org.springframework.data;
import static de.schauderhaft.degraph.check.JCheck.*;
import static org.junit.Assert.*;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* @author Jens Schauder
*/
@Disabled("Requires newer version of ASM 5.1")
public class DependencyTests {
@Test

View File

@@ -19,9 +19,6 @@ import static org.assertj.core.api.Assertions.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import java.text.DateFormat;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
@@ -33,6 +30,7 @@ import org.jmolecules.ddd.types.Association;
import org.jmolecules.ddd.types.Identifier;
import org.joda.time.DateTime;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.converter.ConverterFactory;
@@ -48,6 +46,7 @@ import org.springframework.data.convert.Jsr310Converters.LocalDateTimeToDateConv
import org.springframework.data.convert.ThreeTenBackPortConverters.LocalDateTimeToJavaTimeInstantConverter;
import org.springframework.data.geo.Point;
import org.springframework.data.mapping.model.SimpleTypeHolder;
import org.threeten.bp.LocalDateTime;
/**
@@ -163,8 +162,8 @@ class CustomConversionsUnitTests {
void shouldSelectPropertCustomReadTargetForCglibProxiedType() {
CustomConversions conversions = new CustomConversions(StoreConversions.NONE,
Arrays.asList(CustomObjectToStringConverter.INSTANCE));
assertThat(conversions.hasCustomReadTarget(createProxyTypeFor(Object.class), String.class)).isTrue();
Arrays.asList(CustomTypeToStringConverter.INSTANCE));
assertThat(conversions.hasCustomReadTarget(createProxyTypeFor(CustomType.class), String.class)).isTrue();
}
@Test // DATAMONGO-1131, DATACMNS-1035
@@ -316,7 +315,7 @@ class CustomConversionsUnitTests {
INSTANCE;
public Format convert(String source) {
return DateFormat.getInstance();
return new DateFormat();
}
}
@@ -367,12 +366,13 @@ class CustomConversionsUnitTests {
}
}
enum CustomObjectToStringConverter implements Converter<Object, String> {
@ReadingConverter
enum CustomTypeToStringConverter implements Converter<CustomType, String> {
INSTANCE;
@Override
public String convert(Object source) {
public String convert(CustomType source) {
return source != null ? source.toString() : null;
}
@@ -414,7 +414,7 @@ class CustomConversionsUnitTests {
}
try {
return targetType.newInstance();
return targetType.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
@@ -423,4 +423,11 @@ class CustomConversionsUnitTests {
}
static class CustomType {}
static class Format {}
static class DateFormat extends Format {}
static class SimpleDateFormat extends DateFormat {}
}

View File

@@ -296,13 +296,13 @@ class AbstractMappingContextUnitTests {
}
@Test // GH-2390
void detectsEntityTypeEveneIfSimpleTypeHolderConsidersCollectionsSimple() {
void detectsEntityTypeEvenIfSimpleTypeHolderConsidersCollectionsSimple() {
context.setSimpleTypeHolder(new SimpleTypeHolder(Collections.emptySet(), true) {
@Override
public boolean isSimpleType(Class<?> type) {
return type.getName().startsWith("java.util.");
return type == String.class || type.getName().startsWith("java.util.");
}
});

View File

@@ -24,7 +24,6 @@ import lombok.With;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.function.Function;
import org.junit.jupiter.api.Test;
@@ -130,7 +129,7 @@ public class PersistentPropertyAccessorTests {
void kotlinCopyMethodShouldNotSetUnsettableProperty(
Function<Object, PersistentPropertyAccessor<?>> propertyAccessorFunction) {
SingleSettableProperty bean = new SingleSettableProperty(UUID.randomUUID());
SingleSettableProperty bean = new SingleSettableProperty(1.1);
PersistentPropertyAccessor accessor = propertyAccessorFunction.apply(bean);
SamplePersistentProperty property = getProperty(bean, "version");
@@ -224,4 +223,9 @@ public class PersistentPropertyAccessorTests {
String immutable;
}
static class UnsettableVersion {
private final int version = (int) Math.random();
}
}