Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
snicoll committed Jan 5, 2024
1 parent 7c9307e commit af2e13e
Show file tree
Hide file tree
Showing 49 changed files with 205 additions and 217 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -56,7 +56,6 @@ void registerTypeIfPresentRegistersExistingClass() {
}

@Test
@SuppressWarnings("unchecked")
void registerTypeIfPresentIgnoresMissingClass() {
Consumer<TypeHint.Builder> hintBuilder = mock();
this.reflectionHints.registerTypeIfPresent(null, "com.example.DoesNotExist", hintBuilder);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -132,7 +132,6 @@ void registerIfPresentRegisterExistingLocation() {
}

@Test
@SuppressWarnings("unchecked")
void registerIfPresentIgnoreMissingLocation() {
Consumer<ResourcePatternHints.Builder> hintBuilder = mock();
this.resourceHints.registerPatternIfPresent(null, "location/does-not-exist/", hintBuilder);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -183,19 +183,19 @@ void resolveIncompleteTypeVariables() {
}

@Test
public void resolvePartiallySpecializedTypeVariables() {
void resolvePartiallySpecializedTypeVariables() {
Type resolved = resolveType(BiGenericClass.class.getTypeParameters()[0], TypeFixedBiGenericClass.class);
assertThat(resolved).isEqualTo(D.class);
}

@Test
public void resolveTransitiveTypeVariableWithDifferentName() {
void resolveTransitiveTypeVariableWithDifferentName() {
Type resolved = resolveType(BiGenericClass.class.getTypeParameters()[1], TypeFixedBiGenericClass.class);
assertThat(resolved).isEqualTo(E.class);
}

@Test
public void resolveMethodParameterWithNestedGenerics() {
void resolveMethodParameterWithNestedGenerics() {
Method method = method(WithMethodParameter.class, "nestedGenerics", List.class);
MethodParameter methodParameter = new MethodParameter(method, 0);
Type resolvedType = resolveType(methodParameter.getGenericParameterType(), WithMethodParameter.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -293,7 +293,7 @@ void getAllAnnotationAttributesOnNonAnnotatedClass() {
void getAllAnnotationAttributesOnClassWithLocalAnnotation() {
MultiValueMap<String, Object> attributes = getAllAnnotationAttributes(TxConfig.class, TX_NAME);
assertThat(attributes).as("Annotation attributes map for @Transactional on TxConfig").isNotNull();
assertThat(attributes.get("value")).as("value for TxConfig").isEqualTo(asList("TxConfig"));
assertThat(attributes.get("value")).as("value for TxConfig").isEqualTo(List.of("TxConfig"));
}

@Test
Expand All @@ -307,14 +307,14 @@ void getAllAnnotationAttributesOnClassWithLocalComposedAnnotationAndInheritedAnn
void getAllAnnotationAttributesFavorsInheritedAnnotationsOverMoreLocallyDeclaredComposedAnnotations() {
MultiValueMap<String, Object> attributes = getAllAnnotationAttributes(SubSubClassWithInheritedAnnotation.class, TX_NAME);
assertThat(attributes).as("Annotation attributes map for @Transactional on SubSubClassWithInheritedAnnotation").isNotNull();
assertThat(attributes.get("qualifier")).isEqualTo(asList("transactionManager"));
assertThat(attributes.get("qualifier")).isEqualTo(List.of("transactionManager"));
}

@Test
void getAllAnnotationAttributesFavorsInheritedComposedAnnotationsOverMoreLocallyDeclaredComposedAnnotations() {
MultiValueMap<String, Object> attributes = getAllAnnotationAttributes( SubSubClassWithInheritedComposedAnnotation.class, TX_NAME);
assertThat(attributes).as("Annotation attributes map for @Transactional on SubSubClassWithInheritedComposedAnnotation").isNotNull();
assertThat(attributes.get("qualifier")).isEqualTo(asList("composed1"));
assertThat(attributes.get("qualifier")).isEqualTo(List.of("composed1"));
}

/**
Expand All @@ -329,7 +329,7 @@ void getAllAnnotationAttributesOnClassWithLocalAnnotationThatShadowsAnnotationFr
// See org.springframework.core.env.EnvironmentSystemIntegrationTests#mostSpecificDerivedClassDrivesEnvironment_withDevEnvAndDerivedDevConfigClass
MultiValueMap<String, Object> attributes = getAllAnnotationAttributes(DerivedTxConfig.class, TX_NAME);
assertThat(attributes).as("Annotation attributes map for @Transactional on DerivedTxConfig").isNotNull();
assertThat(attributes.get("value")).as("value for DerivedTxConfig").isEqualTo(asList("DerivedTxConfig"));
assertThat(attributes.get("value")).as("value for DerivedTxConfig").isEqualTo(List.of("DerivedTxConfig"));
}

/**
Expand All @@ -348,15 +348,15 @@ void getAllAnnotationAttributesOnLangType() {
MultiValueMap<String, Object> attributes = getAllAnnotationAttributes(
NonNullApi.class, Nonnull.class.getName());
assertThat(attributes).as("Annotation attributes map for @Nonnull on NonNullApi").isNotNull();
assertThat(attributes.get("when")).as("value for NonNullApi").isEqualTo(asList(When.ALWAYS));
assertThat(attributes.get("when")).as("value for NonNullApi").isEqualTo(List.of(When.ALWAYS));
}

@Test
void getAllAnnotationAttributesOnJavaxType() {
MultiValueMap<String, Object> attributes = getAllAnnotationAttributes(
ParametersAreNonnullByDefault.class, Nonnull.class.getName());
assertThat(attributes).as("Annotation attributes map for @Nonnull on NonNullApi").isNotNull();
assertThat(attributes.get("when")).as("value for NonNullApi").isEqualTo(asList(When.ALWAYS));
assertThat(attributes.get("when")).as("value for NonNullApi").isEqualTo(List.of(When.ALWAYS));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -882,7 +882,7 @@ void synthesizeAnnotationFromMapWithAttributeAliasesThatOverrideArraysWithSingle
}

@Test
void synthesizeAnnotationFromMapWithImplicitAttributeAliases() throws Exception {
void synthesizeAnnotationFromMapWithImplicitAttributeAliases() {
assertAnnotationSynthesisFromMapWithImplicitAliases("value");
assertAnnotationSynthesisFromMapWithImplicitAliases("location1");
assertAnnotationSynthesisFromMapWithImplicitAliases("location2");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -161,8 +161,7 @@ void typeHierarchyStrategyComposedPlusLocalAnnotationsOnMethod()
}

@Test
void typeHierarchyStrategyMultipleComposedAnnotationsOnBridgeMethod()
throws Exception {
void typeHierarchyStrategyMultipleComposedAnnotationsOnBridgeMethod() {
assertTypeHierarchyStrategyBehavior(getBridgeMethod());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -415,7 +415,7 @@ void collectMultiValueMapFromClassWithLocalAnnotation() {
MultiValueMap<String, Object> map = MergedAnnotations.from(TxConfig.class).stream(
Transactional.class).collect(
MergedAnnotationCollectors.toMultiValueMap());
assertThat(map).contains(entry("value", Arrays.asList("TxConfig")));
assertThat(map).contains(entry("value", List.of("TxConfig")));
}

@Test
Expand All @@ -434,7 +434,7 @@ void collectMultiValueMapFavorsInheritedAnnotationsOverMoreLocallyDeclaredCompos
SubSubClassWithInheritedAnnotation.class,
SearchStrategy.INHERITED_ANNOTATIONS).stream(Transactional.class).collect(
MergedAnnotationCollectors.toMultiValueMap());
assertThat(map).contains(entry("qualifier", Arrays.asList("transactionManager")));
assertThat(map).contains(entry("qualifier", List.of("transactionManager")));
}

@Test
Expand All @@ -443,7 +443,7 @@ void collectMultiValueMapFavorsInheritedComposedAnnotationsOverMoreLocallyDeclar
SubSubClassWithInheritedComposedAnnotation.class,
SearchStrategy.INHERITED_ANNOTATIONS).stream(Transactional.class).collect(
MergedAnnotationCollectors.toMultiValueMap());
assertThat(map).contains(entry("qualifier", Arrays.asList("composed1")));
assertThat(map).contains(entry("qualifier", List.of("composed1")));
}

/**
Expand All @@ -458,7 +458,7 @@ void collectMultiValueMapFromClassWithLocalAnnotationThatShadowsAnnotationFromSu
MultiValueMap<String, Object> map = MergedAnnotations.from(DerivedTxConfig.class,
SearchStrategy.INHERITED_ANNOTATIONS).stream(Transactional.class).collect(
MergedAnnotationCollectors.toMultiValueMap());
assertThat(map).contains(entry("value", Arrays.asList("DerivedTxConfig")));
assertThat(map).contains(entry("value", List.of("DerivedTxConfig")));
}

/**
Expand Down Expand Up @@ -855,7 +855,6 @@ void streamTypeHierarchyFromClassWithInterface() throws Exception {
}

@Test
@SuppressWarnings("deprecation")
void getFromMethodWithMethodAnnotationOnLeaf() throws Exception {
Method method = Leaf.class.getMethod("annotatedOnLeaf");
assertThat(method.getAnnotation(Order.class)).isNotNull();
Expand Down Expand Up @@ -1731,7 +1730,7 @@ void synthesizeWhenAttributeAliasForMetaAnnotationThatIsNotMetaPresent() {
}

@Test
void synthesizeWithImplicitAliases() throws Exception {
void synthesizeWithImplicitAliases() {
testSynthesisWithImplicitAliases(ValueImplicitAliasesTestConfigurationClass.class, "value");
testSynthesisWithImplicitAliases(Location1ImplicitAliasesTestConfigurationClass.class, "location1");
testSynthesisWithImplicitAliases(XmlImplicitAliasesTestConfigurationClass.class, "xmlFile");
Expand Down Expand Up @@ -1965,7 +1964,7 @@ private void synthesizeFromMapWithAttributeAliasesThatOverrideArraysWithSingleEl
}

@Test
void synthesizeFromMapWithImplicitAttributeAliases() throws Exception {
void synthesizeFromMapWithImplicitAttributeAliases() {
testSynthesisFromMapWithImplicitAliases("value");
testSynthesisFromMapWithImplicitAliases("location1");
testSynthesisFromMapWithImplicitAliases("location2");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -106,7 +106,7 @@ void getComposedPlusLocalAnnotationsOnMethod() throws Exception {

@Test
@Disabled("Disabled since some Java 8 updates handle the bridge method differently")
void getMultipleComposedAnnotationsOnBridgeMethod() throws Exception {
void getMultipleComposedAnnotationsOnBridgeMethod() {
Set<Cacheable> cacheables = getAllMergedAnnotations(getBridgeMethod(), Cacheable.class);
assertThat(cacheables).isNotNull();
assertThat(cacheables).isEmpty();
Expand Down Expand Up @@ -178,7 +178,7 @@ void findComposedPlusLocalAnnotationsOnMethod() throws Exception {
}

@Test
void findMultipleComposedAnnotationsOnBridgeMethod() throws Exception {
void findMultipleComposedAnnotationsOnBridgeMethod() {
assertFindAllMergedAnnotationsBehavior(getBridgeMethod());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -45,7 +45,7 @@ class ByteArrayDecoderTests extends AbstractDecoderTests<ByteArrayDecoder> {

@Override
@Test
public void canDecode() {
protected void canDecode() {
assertThat(this.decoder.canDecode(ResolvableType.forClass(byte[].class),
MimeTypeUtils.TEXT_PLAIN)).isTrue();
assertThat(this.decoder.canDecode(ResolvableType.forClass(Integer.class),
Expand All @@ -56,7 +56,7 @@ public void canDecode() {

@Override
@Test
public void decode() {
protected void decode() {
Flux<DataBuffer> input = Flux.concat(
dataBuffer(this.fooBytes),
dataBuffer(this.barBytes));
Expand All @@ -70,7 +70,7 @@ public void decode() {

@Override
@Test
public void decodeToMono() {
protected void decodeToMono() {
Flux<DataBuffer> input = Flux.concat(
dataBuffer(this.fooBytes),
dataBuffer(this.barBytes));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -43,7 +43,7 @@ class ByteArrayEncoderTests extends AbstractEncoderTests<ByteArrayEncoder> {

@Override
@Test
public void canEncode() {
protected void canEncode() {
assertThat(this.encoder.canEncode(ResolvableType.forClass(byte[].class),
MimeTypeUtils.TEXT_PLAIN)).isTrue();
assertThat(this.encoder.canEncode(ResolvableType.forClass(Integer.class),
Expand All @@ -57,7 +57,7 @@ public void canEncode() {

@Override
@Test
public void encode() {
protected void encode() {
Flux<byte[]> input = Flux.just(this.fooBytes, this.barBytes);

testEncodeAll(input, byte[].class, step -> step
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -46,7 +46,7 @@ class ByteBufferDecoderTests extends AbstractDecoderTests<ByteBufferDecoder> {

@Override
@Test
public void canDecode() {
protected void canDecode() {
assertThat(this.decoder.canDecode(ResolvableType.forClass(ByteBuffer.class),
MimeTypeUtils.TEXT_PLAIN)).isTrue();
assertThat(this.decoder.canDecode(ResolvableType.forClass(Integer.class),
Expand All @@ -57,7 +57,7 @@ public void canDecode() {

@Override
@Test
public void decode() {
protected void decode() {
Flux<DataBuffer> input = Flux.concat(
dataBuffer(this.fooBytes),
dataBuffer(this.barBytes));
Expand All @@ -72,7 +72,7 @@ public void decode() {

@Override
@Test
public void decodeToMono() {
protected void decodeToMono() {
Flux<DataBuffer> input = Flux.concat(
dataBuffer(this.fooBytes),
dataBuffer(this.barBytes));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -43,7 +43,7 @@ class ByteBufferEncoderTests extends AbstractEncoderTests<ByteBufferEncoder> {

@Override
@Test
public void canEncode() {
protected void canEncode() {
assertThat(this.encoder.canEncode(ResolvableType.forClass(ByteBuffer.class),
MimeTypeUtils.TEXT_PLAIN)).isTrue();
assertThat(this.encoder.canEncode(ResolvableType.forClass(Integer.class),
Expand All @@ -57,7 +57,7 @@ public void canEncode() {

@Override
@Test
public void encode() {
protected void encode() {
Flux<ByteBuffer> input = Flux.just(this.fooBytes, this.barBytes)
.map(ByteBuffer::wrap);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -55,7 +55,7 @@ class CharBufferDecoderTests extends AbstractDecoderTests<CharBufferDecoder> {

@Override
@Test
public void canDecode() {
protected void canDecode() {
assertThat(this.decoder.canDecode(TYPE, MimeTypeUtils.TEXT_PLAIN)).isTrue();
assertThat(this.decoder.canDecode(TYPE, MimeTypeUtils.TEXT_HTML)).isTrue();
assertThat(this.decoder.canDecode(TYPE, MimeTypeUtils.APPLICATION_JSON)).isTrue();
Expand All @@ -66,7 +66,7 @@ public void canDecode() {

@Override
@Test
public void decode() {
protected void decode() {
CharBuffer u = charBuffer("ü");
CharBuffer e = charBuffer("é");
CharBuffer o = charBuffer("ø");
Expand Down Expand Up @@ -230,7 +230,7 @@ void decodeEmptyDataBuffer() {

@Override
@Test
public void decodeToMono() {
protected void decodeToMono() {
Flux<DataBuffer> input = Flux.just(
stringBuffer("foo"),
stringBuffer("bar"),
Expand Down
Loading

0 comments on commit af2e13e

Please sign in to comment.