Avoid String allocations with Assert.notNull()
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -62,7 +62,7 @@ public abstract class AbstractCacheOperationTests<O extends JCacheOperation<?>>
|
||||
Class<?> targetType, String methodName,
|
||||
Class<?>... parameterTypes) {
|
||||
Method method = ReflectionUtils.findMethod(targetType, methodName, parameterTypes);
|
||||
Assert.notNull(method, "requested method '" + methodName + "'does not exist");
|
||||
Assert.notNull(method, () -> "requested method '" + methodName + "'does not exist");
|
||||
A cacheAnnotation = method.getAnnotation(annotationType);
|
||||
return new DefaultCacheMethodDetails<>(method, cacheAnnotation, getCacheName(cacheAnnotation));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -202,7 +202,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
||||
|
||||
private JCacheOperation<?> getCacheOperation(Class<?> targetType, String methodName, Class<?>... parameterTypes) {
|
||||
Method method = ReflectionUtils.findMethod(targetType, methodName, parameterTypes);
|
||||
Assert.notNull(method, "requested method '" + methodName + "'does not exist");
|
||||
Assert.notNull(method, () -> "requested method '" + methodName + "'does not exist");
|
||||
return source.getCacheOperation(method, targetType);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user