Polishing

This commit is contained in:
Juergen Hoeller 2023-11-20 21:01:40 +01:00
parent 695559879e
commit fff50657d2
6 changed files with 39 additions and 35 deletions

View File

@ -54,7 +54,7 @@ class EnableCachingIntegrationTests {
@AfterEach
public void closeContext() {
void closeContext() {
if (this.context != null) {
this.context.close();
}

View File

@ -60,6 +60,7 @@ class CacheErrorHandlerTests {
private SimpleService simpleService;
@BeforeEach
void setup() {
this.context = new AnnotationConfigApplicationContext(Config.class);
@ -69,11 +70,13 @@ class CacheErrorHandlerTests {
this.simpleService = context.getBean(SimpleService.class);
}
@AfterEach
void tearDown() {
void closeContext() {
this.context.close();
}
@Test
void getFail() {
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on get");
@ -107,9 +110,9 @@ class CacheErrorHandlerTests {
this.cacheInterceptor.setErrorHandler(new SimpleCacheErrorHandler());
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
this.simpleService.get(0L))
.withMessage("Test exception on get");
assertThatExceptionOfType(UnsupportedOperationException.class)
.isThrownBy(() -> this.simpleService.get(0L))
.withMessage("Test exception on get");
}
@Test
@ -128,9 +131,9 @@ class CacheErrorHandlerTests {
this.cacheInterceptor.setErrorHandler(new SimpleCacheErrorHandler());
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
this.simpleService.put(0L))
.withMessage("Test exception on put");
assertThatExceptionOfType(UnsupportedOperationException.class)
.isThrownBy(() -> this.simpleService.put(0L))
.withMessage("Test exception on put");
}
@Test
@ -149,9 +152,9 @@ class CacheErrorHandlerTests {
this.cacheInterceptor.setErrorHandler(new SimpleCacheErrorHandler());
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
this.simpleService.evict(0L))
.withMessage("Test exception on evict");
assertThatExceptionOfType(UnsupportedOperationException.class)
.isThrownBy(() -> this.simpleService.evict(0L))
.withMessage("Test exception on evict");
}
@Test
@ -170,9 +173,9 @@ class CacheErrorHandlerTests {
this.cacheInterceptor.setErrorHandler(new SimpleCacheErrorHandler());
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
this.simpleService.clear())
.withMessage("Test exception on clear");
assertThatExceptionOfType(UnsupportedOperationException.class)
.isThrownBy(() -> this.simpleService.clear())
.withMessage("Test exception on clear");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -51,6 +51,7 @@ public class CachePutEvaluationTests {
private SimpleService service;
@BeforeEach
public void setup() {
this.context = new AnnotationConfigApplicationContext(Config.class);
@ -59,12 +60,11 @@ public class CachePutEvaluationTests {
}
@AfterEach
public void close() {
if (this.context != null) {
this.context.close();
}
public void closeContext() {
this.context.close();
}
@Test
public void mutualGetPutExclusion() {
String key = "1";

View File

@ -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.
@ -72,7 +72,7 @@ class CacheResolverCustomizationTests {
}
@AfterEach
void tearDown() {
void closeContext() {
this.context.close();
}
@ -142,16 +142,17 @@ class CacheResolverCustomizationTests {
@Test
void noCacheResolved() {
Method method = ReflectionUtils.findMethod(SimpleService.class, "noCacheResolved", Object.class);
assertThatIllegalStateException().isThrownBy(() ->
this.simpleService.noCacheResolved(new Object()))
.withMessageContaining(method.toString());
assertThatIllegalStateException()
.isThrownBy(() -> this.simpleService.noCacheResolved(new Object()))
.withMessageContaining(method.toString());
}
@Test
void unknownCacheResolver() {
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
this.simpleService.unknownCacheResolver(new Object()))
.satisfies(ex -> assertThat(ex.getBeanName()).isEqualTo("unknownCacheResolver"));
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
.isThrownBy(() -> this.simpleService.unknownCacheResolver(new Object()))
.satisfies(ex -> assertThat(ex.getBeanName()).isEqualTo("unknownCacheResolver"));
}

View File

@ -1350,12 +1350,12 @@
set on the "Access-Control-Allow-Credentials" response header of
preflight requests.
NOTE: Be aware that this option establishes a high
level of trust with the configured domains and also increases the surface
attack of the web application by exposing sensitive user-specific
information such as cookies and CSRF tokens.
NOTE: Be aware that this option establishes a high level of trust with
the configured domains and also increases the surface attack of the web
application by exposing sensitive user-specific information such as
cookies and CSRF tokens.
By default this is not set in which case the
By default, this is not set in which case the
"Access-Control-Allow-Credentials" header is also not set and
credentials are therefore not allowed.
]]></xsd:documentation>

View File

@ -420,7 +420,7 @@
<xsd:annotation>
<xsd:documentation source="java:org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"><![CDATA[
Set the core pool size of the ThreadPoolExecutor.
NOTE: the core pool size is effectively the max pool size when an unbounded queue-capacity is configured (the default).
NOTE: The core pool size is effectively the max pool size when an unbounded queue-capacity is configured (the default).
This is essentially the "Unbounded queues" strategy as explained in java.util.concurrent.ThreadPoolExecutor.
When this strategy is used, the max pool size is effectively ignored.
By default this is set to twice the value of Runtime.availableProcessors().
@ -433,7 +433,7 @@
<xsd:annotation>
<xsd:documentation source="java:org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"><![CDATA[
Set the max pool size of the ThreadPoolExecutor.
NOTE: when an unbounded queue-capacity is configured (the default), the max pool size is effectively ignored.
NOTE: When an unbounded queue-capacity is configured (the default), the max pool size is effectively ignored.
See the "Unbounded queues" strategy in java.util.concurrent.ThreadPoolExecutor for more details.
By default this is set to Integer.MAX_VALUE.
]]></xsd:documentation>
@ -453,7 +453,7 @@
<xsd:annotation>
<xsd:documentation source="java:org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"><![CDATA[
Set the queue capacity for the ThreadPoolExecutor.
NOTE: when an unbounded queue-capacity is configured (the default) the core pool size is effectively the max pool size.
NOTE: When an unbounded queue-capacity is configured (the default) the core pool size is effectively the max pool size.
This is essentially the "Unbounded queues" strategy as explained in java.util.concurrent.ThreadPoolExecutor.
When this strategy is used, the max pool size is effectively ignored.
By default this is set to Integer.MAX_VALUE.