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

@@ -205,7 +205,7 @@ public class TestContextAotGenerator {
Class<?> testClass = mergedConfig.getTestClass();
ContextLoader contextLoader = mergedConfig.getContextLoader();
Assert.notNull(contextLoader, """
Assert.notNull(contextLoader, () -> """
Cannot load an ApplicationContext with a NULL 'contextLoader'. \
Consider annotating test class [%s] with @ContextConfiguration or \
@ContextHierarchy.""".formatted(testClass.getName()));

View File

@@ -184,7 +184,7 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
}
else {
String[] locations = mergedContextConfiguration.getLocations();
Assert.notNull(locations, """
Assert.notNull(locations, () -> """
Cannot load an ApplicationContext with a NULL 'locations' array. \
Consider annotating test class [%s] with @ContextConfiguration or \
@ContextHierarchy.""".formatted(mergedContextConfiguration.getTestClass().getName()));
@@ -224,7 +224,7 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
private ContextLoader getContextLoader(MergedContextConfiguration mergedConfig) {
ContextLoader contextLoader = mergedConfig.getContextLoader();
Assert.notNull(contextLoader, """
Assert.notNull(contextLoader, () -> """
Cannot load an ApplicationContext with a NULL 'contextLoader'. \
Consider annotating test class [%s] with @ContextConfiguration or \
@ContextHierarchy.""".formatted(mergedConfig.getTestClass().getName()));