Polish "Add Kotlin extensions for Cache and CacheManager"

See gh-23927
This commit is contained in:
Stephane Nicoll
2021-12-02 14:49:46 +01:00
parent 5ec1e20242
commit 65dc2afe9d
4 changed files with 57 additions and 7 deletions

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2002-2021 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cache
import org.junit.jupiter.api.Assertions.assertEquals
@@ -27,5 +43,6 @@ class CacheExtensionsTest {
assertEquals("v", cache.get("k", String::class.java))
}
private fun createCache(cacheName: String = "c"): Cache = ConcurrentMapCacheManager(cacheName).getCache(cacheName)!!
private fun createCache(cacheName: String = "c"): Cache =
ConcurrentMapCacheManager(cacheName).getCache(cacheName)!!
}

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2002-2021 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cache
import org.junit.jupiter.api.Assertions.assertNotEquals
@@ -12,5 +28,6 @@ class CacheManagerExtensionsTest {
assertNotEquals(null, cm["c"])
}
private fun createCacheManager(cacheName: String = "c"): CacheManager = ConcurrentMapCacheManager(cacheName)
private fun createCacheManager(cacheName: String = "c"): CacheManager =
ConcurrentMapCacheManager(cacheName)
}