Avoid String allocations with Assert.notNull()

This commit is contained in:
Sam Brannen
2022-11-08 14:23:22 +01:00
parent 9e4cddf5db
commit 9d73f81e9c
5 changed files with 8 additions and 8 deletions

View File

@@ -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));
}

View File

@@ -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);
}