Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
snicoll committed Dec 16, 2023
1 parent b56fc50 commit 22bf4df
Show file tree
Hide file tree
Showing 52 changed files with 281 additions and 290 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@

package org.springframework.aot.hint;

import java.io.IOException;
import java.lang.reflect.Type;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
Expand Down Expand Up @@ -443,7 +441,7 @@ public CustomDeserializer1() {
}

@Override
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JacksonException {
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) {
return null;
}
}
Expand All @@ -456,7 +454,7 @@ public CustomDeserializer2() {
}

@Override
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JacksonException {
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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 @@ -59,7 +59,7 @@ void throwExceptionWithoutAnnotationAttributeOnClass() {
}

@Test
void throwExceptionWithoutAnnotationAttributeOnMethod() throws NoSuchMethodException {
void throwExceptionWithoutAnnotationAttributeOnMethod() {
assertThatThrownBy(() -> processor.registerReflectionHints(hints.reflection(),
SampleClassWithoutMethodLevelAnnotationAttribute.class.getMethod("method")))
.isInstanceOf(IllegalStateException.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void withDoubleBoundParameterizedOnInstantiate() throws Exception {
}

@Test
void withGenericParameter() throws Exception {
void withGenericParameter() {
Method[] methods = StringGenericParameter.class.getMethods();
Method bridgeMethod = null;
Method bridgedMethod = null;
Expand All @@ -173,7 +173,7 @@ void withGenericParameter() throws Exception {
}

@Test
void onAllMethods() throws Exception {
void onAllMethods() {
Method[] methods = StringList.class.getMethods();
for (Method method : methods) {
assertThat(BridgeMethodResolver.findBridgedMethod(method)).isNotNull();
Expand Down Expand Up @@ -206,7 +206,7 @@ void spr2603() throws Exception {
}

@Test
void spr2648() throws Exception {
void spr2648() {
Method bridgeMethod = ReflectionUtils.findMethod(GenericSqlMapIntegerDao.class, "saveOrUpdate", Object.class);
assertThat(bridgeMethod != null && bridgeMethod.isBridge()).isTrue();
Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(bridgeMethod);
Expand Down Expand Up @@ -296,7 +296,7 @@ void spr3485() throws Exception {
}

@Test
void spr3534() throws Exception {
void spr3534() {
Method bridgeMethod = ReflectionUtils.findMethod(TestEmailProvider.class, "findBy", Object.class);
assertThat(bridgeMethod != null && bridgeMethod.isBridge()).isTrue();
Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(bridgeMethod);
Expand Down Expand Up @@ -843,7 +843,7 @@ public void receive(ModifiedMessageEvent event) {

public interface SimpleGenericRepository<T> {

public Class<T> getPersistentClass();
Class<T> getPersistentClass();

List<T> findByQuery();

Expand Down Expand Up @@ -884,7 +884,7 @@ public <T> SimpleGenericRepository<T> getFor(Class<T> entityType) {
return null;
}

public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void rejectsNullMapType() {


enum Color {
RED, BLUE;
RED, BLUE
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -192,28 +192,28 @@ void toCode() {
}

@Test
void getValuesWithNullPrefix() throws Exception {
void getValuesWithNullPrefix() {
Constants c = new Constants(A.class);
Set<?> values = c.getValues(null);
assertThat(values).as("Must have returned *all* public static final values").hasSize(7);
}

@Test
void getValuesWithEmptyStringPrefix() throws Exception {
void getValuesWithEmptyStringPrefix() {
Constants c = new Constants(A.class);
Set<Object> values = c.getValues("");
assertThat(values).as("Must have returned *all* public static final values").hasSize(7);
}

@Test
void getValuesWithWhitespacedStringPrefix() throws Exception {
void getValuesWithWhitespacedStringPrefix() {
Constants c = new Constants(A.class);
Set<?> values = c.getValues(" ");
assertThat(values).as("Must have returned *all* public static final values").hasSize(7);
}

@Test
void withClassThatExposesNoConstants() throws Exception {
void withClassThatExposesNoConstants() {
Constants c = new Constants(NoConstants.class);
assertThat(c.getSize()).isEqualTo(0);
final Set<?> values = c.getValues("");
Expand All @@ -222,7 +222,7 @@ void withClassThatExposesNoConstants() throws Exception {
}

@Test
void ctorWithNullClass() throws Exception {
void ctorWithNullClass() {
assertThatIllegalArgumentException().isThrownBy(() ->
new Constants(null));
}
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-2023 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 @@ -30,55 +30,55 @@
class ExceptionDepthComparatorTests {

@Test
void targetBeforeSameDepth() throws Exception {
void targetBeforeSameDepth() {
Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, SameDepthException.class);
assertThat(foundClass).isEqualTo(TargetException.class);
}

@Test
void sameDepthBeforeTarget() throws Exception {
void sameDepthBeforeTarget() {
Class<? extends Throwable> foundClass = findClosestMatch(SameDepthException.class, TargetException.class);
assertThat(foundClass).isEqualTo(TargetException.class);
}

@Test
void lowestDepthBeforeTarget() throws Exception {
void lowestDepthBeforeTarget() {
Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, TargetException.class);
assertThat(foundClass).isEqualTo(TargetException.class);
}

@Test
void targetBeforeLowestDepth() throws Exception {
void targetBeforeLowestDepth() {
Class<? extends Throwable> foundClass = findClosestMatch(TargetException.class, LowestDepthException.class);
assertThat(foundClass).isEqualTo(TargetException.class);
}

@Test
void noDepthBeforeTarget() throws Exception {
void noDepthBeforeTarget() {
Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, TargetException.class);
assertThat(foundClass).isEqualTo(TargetException.class);
}

@Test
void noDepthBeforeHighestDepth() throws Exception {
void noDepthBeforeHighestDepth() {
Class<? extends Throwable> foundClass = findClosestMatch(NoDepthException.class, HighestDepthException.class);
assertThat(foundClass).isEqualTo(HighestDepthException.class);
}

@Test
void highestDepthBeforeNoDepth() throws Exception {
void highestDepthBeforeNoDepth() {
Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, NoDepthException.class);
assertThat(foundClass).isEqualTo(HighestDepthException.class);
}

@Test
void highestDepthBeforeLowestDepth() throws Exception {
void highestDepthBeforeLowestDepth() {
Class<? extends Throwable> foundClass = findClosestMatch(HighestDepthException.class, LowestDepthException.class);
assertThat(foundClass).isEqualTo(LowestDepthException.class);
}

@Test
void lowestDepthBeforeHighestDepth() throws Exception {
void lowestDepthBeforeHighestDepth() {
Class<? extends Throwable> foundClass = findClosestMatch(LowestDepthException.class, HighestDepthException.class);
assertThat(foundClass).isEqualTo(LowestDepthException.class);
}
Expand Down

0 comments on commit 22bf4df

Please sign in to comment.