Rely on automatic boxing/unboxing in tests

Closes gh-29414
This commit is contained in:
Kulwant Singh
2022-11-02 01:11:28 +01:00
committed by Sam Brannen
parent 7d68d0625c
commit b2c8546013
35 changed files with 214 additions and 214 deletions

View File

@@ -109,7 +109,7 @@ class AroundAdviceBindingTestAspect {
public int oneObjectArg(ProceedingJoinPoint pjp, Object bean) throws Throwable {
this.collaborator.oneObjectArg(bean);
return ((Integer) pjp.proceed()).intValue();
return (Integer) pjp.proceed();
}
public void oneIntAndOneObject(ProceedingJoinPoint pjp, int x , Object o) throws Throwable {
@@ -119,7 +119,7 @@ class AroundAdviceBindingTestAspect {
public int justJoinPoint(ProceedingJoinPoint pjp) throws Throwable {
this.collaborator.justJoinPoint(pjp.getSignature().getName());
return ((Integer) pjp.proceed()).intValue();
return (Integer) pjp.proceed();
}
/**

View File

@@ -189,7 +189,7 @@ class PrecedenceTestAspect implements BeanNameAware, Ordered {
int ret = -1;
this.collaborator.aroundAdviceOne(this.name);
try {
ret = ((Integer)pjp.proceed()).intValue();
ret = (Integer) pjp.proceed();
}
catch (Throwable t) {
throw new RuntimeException(t);
@@ -202,7 +202,7 @@ class PrecedenceTestAspect implements BeanNameAware, Ordered {
int ret = -1;
this.collaborator.aroundAdviceTwo(this.name);
try {
ret = ((Integer)pjp.proceed()).intValue();
ret = (Integer) pjp.proceed();
}
catch (Throwable t) {
throw new RuntimeException(t);

View File

@@ -167,14 +167,14 @@ class ProceedTestingAspect implements Ordered {
}
public Object doubleOrQuits(ProceedingJoinPoint pjp) throws Throwable {
int value = ((Integer) pjp.getArgs()[0]).intValue();
pjp.getArgs()[0] = Integer.valueOf(value * 2);
int value = (Integer) pjp.getArgs()[0];
pjp.getArgs()[0] = value * 2;
return pjp.proceed();
}
public Object addOne(ProceedingJoinPoint pjp, Float value) throws Throwable {
float fv = value.floatValue();
return pjp.proceed(new Object[] {Float.valueOf(fv + 1.0F)});
float fv = value;
return pjp.proceed(new Object[] {fv + 1.0F});
}
public void captureStringArgument(JoinPoint tjp, String arg) {
@@ -198,7 +198,7 @@ class ProceedTestingAspect implements Ordered {
}
public void captureFloatArgument(JoinPoint tjp, float arg) {
float tjpArg = ((Float) tjp.getArgs()[0]).floatValue();
float tjpArg = (Float) tjp.getArgs()[0];
if (Math.abs(tjpArg - arg) > 0.000001) {
throw new IllegalStateException(
"argument is '" + arg + "', " +

View File

@@ -1353,7 +1353,7 @@ public abstract class AbstractAopProxyTests {
public int sum;
@Override
public void afterReturning(@Nullable Object returnValue, Method m, Object[] args, @Nullable Object target) throws Throwable {
sum += ((Integer) returnValue).intValue();
sum += (Integer) returnValue;
}
}
SummingAfterAdvice aa = new SummingAfterAdvice();

View File

@@ -83,7 +83,7 @@ class PayloadApplicationEventTests {
void testProgrammaticEventListener() {
List<Auditable> events = new ArrayList<>();
ApplicationListener<AuditablePayloadEvent<String>> listener = events::add;
ApplicationListener<AuditablePayloadEvent<Integer>> mismatch = (event -> event.getPayload().intValue());
ApplicationListener<AuditablePayloadEvent<Integer>> mismatch = (event -> event.getPayload());
ConfigurableApplicationContext ac = new GenericApplicationContext();
ac.addApplicationListener(listener);

View File

@@ -455,7 +455,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
Integer currentCount = (Integer) this.attributeCounts.get(attributeName);
if (currentCount != null) {
int count = currentCount.intValue() + 1;
int count = currentCount + 1;
this.attributeCounts.put(attributeName, count);
}
else {
@@ -468,7 +468,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
public int getCount(String attribute) {
Integer count = (Integer) this.attributeCounts.get(attribute);
return (count == null) ? 0 : count.intValue();
return (count == null) ? 0 : count;
}
public Object getLastHandback(String attributeName) {

View File

@@ -50,7 +50,7 @@ public class ScriptingDefaultsTests {
((AbstractRefreshableTargetSource) advised.getTargetSource());
Field field = AbstractRefreshableTargetSource.class.getDeclaredField("refreshCheckDelay");
field.setAccessible(true);
long delay = ((Long) field.get(targetSource)).longValue();
long delay = (Long) field.get(targetSource);
assertThat(delay).isEqualTo(5000L);
}