This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit fd01a2a0c1411d5bf9af0144cc4b88b34088a282 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Tue Jun 9 15:33:37 2020 +0200 [CAMEL-11807] Upgrade camel-caffeine-lrucache to junit5 --- core/camel-caffeine-lrucache/pom.xml | 4 +-- .../caffeine/lrucache/CaffeineLRUCacheTest.java | 12 ++++---- .../lrucache/CaffeineLRUSoftCacheTest.java | 35 ++++++++++++---------- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/core/camel-caffeine-lrucache/pom.xml b/core/camel-caffeine-lrucache/pom.xml index 3d6531d..5683b50 100644 --- a/core/camel-caffeine-lrucache/pom.xml +++ b/core/camel-caffeine-lrucache/pom.xml @@ -52,8 +52,8 @@ <!-- testing --> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/core/camel-caffeine-lrucache/src/test/java/org/apache/camel/component/caffeine/lrucache/CaffeineLRUCacheTest.java b/core/camel-caffeine-lrucache/src/test/java/org/apache/camel/component/caffeine/lrucache/CaffeineLRUCacheTest.java index 519c3d4..6d7b241 100644 --- a/core/camel-caffeine-lrucache/src/test/java/org/apache/camel/component/caffeine/lrucache/CaffeineLRUCacheTest.java +++ b/core/camel-caffeine-lrucache/src/test/java/org/apache/camel/component/caffeine/lrucache/CaffeineLRUCacheTest.java @@ -18,18 +18,18 @@ package org.apache.camel.component.caffeine.lrucache; import org.apache.camel.Service; import org.apache.camel.support.LRUCache; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; public class CaffeineLRUCacheTest { private LRUCache<String, Service> cache; - @Before + @BeforeEach public void setUp() throws Exception { // for testing use sync listener cache = new CaffeineLRUCache<>(10, 10, true, false, false, true); diff --git a/core/camel-caffeine-lrucache/src/test/java/org/apache/camel/component/caffeine/lrucache/CaffeineLRUSoftCacheTest.java b/core/camel-caffeine-lrucache/src/test/java/org/apache/camel/component/caffeine/lrucache/CaffeineLRUSoftCacheTest.java index e6ee3be..db7f295 100644 --- a/core/camel-caffeine-lrucache/src/test/java/org/apache/camel/component/caffeine/lrucache/CaffeineLRUSoftCacheTest.java +++ b/core/camel-caffeine-lrucache/src/test/java/org/apache/camel/component/caffeine/lrucache/CaffeineLRUSoftCacheTest.java @@ -22,10 +22,13 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.Assert.assertEquals; /** * @@ -73,9 +76,9 @@ public class CaffeineLRUSoftCacheTest { CaffeineLRUSoftCache<Integer, Object> cache = new CaffeineLRUSoftCache<>(1000); Object old = cache.put(1, "foo"); - Assert.assertNull(old); + assertNull(old); old = cache.put(2, "bar"); - Assert.assertNull(old); + assertNull(old); assertEquals("foo", cache.get(1)); assertEquals("bar", cache.get(2)); @@ -149,36 +152,36 @@ public class CaffeineLRUSoftCacheTest { public void testLRUSoftCacheEmpty() throws Exception { CaffeineLRUSoftCache<Integer, Object> cache = new CaffeineLRUSoftCache<>(1000); - Assert.assertTrue(cache.isEmpty()); + assertTrue(cache.isEmpty()); cache.put(1, "foo"); - Assert.assertFalse(cache.isEmpty()); + assertFalse(cache.isEmpty()); cache.put(2, "bar"); - Assert.assertFalse(cache.isEmpty()); + assertFalse(cache.isEmpty()); cache.remove(2); - Assert.assertFalse(cache.isEmpty()); + assertFalse(cache.isEmpty()); cache.clear(); - Assert.assertTrue(cache.isEmpty()); + assertTrue(cache.isEmpty()); } @Test public void testLRUSoftCacheContainsKey() throws Exception { CaffeineLRUSoftCache<Integer, Object> cache = new CaffeineLRUSoftCache<>(1000); - Assert.assertFalse(cache.containsKey(1)); + assertFalse(cache.containsKey(1)); cache.put(1, "foo"); - Assert.assertTrue(cache.containsKey(1)); + assertTrue(cache.containsKey(1)); - Assert.assertFalse(cache.containsKey(2)); + assertFalse(cache.containsKey(2)); cache.put(2, "foo"); - Assert.assertTrue(cache.containsKey(2)); + assertTrue(cache.containsKey(2)); cache.clear(); - Assert.assertFalse(cache.containsKey(1)); - Assert.assertFalse(cache.containsKey(2)); + assertFalse(cache.containsKey(1)); + assertFalse(cache.containsKey(2)); } @Test