diff --git a/libraries-4/README.md b/libraries-4/README.md index f650c073a7..9cda07bdf5 100644 --- a/libraries-4/README.md +++ b/libraries-4/README.md @@ -1,4 +1,4 @@ -## Libraries +## Libraries-4 This module contains articles about various Java libraries. These are small libraries that are relatively easy to use and do not require any separate module of their own. @@ -8,36 +8,14 @@ The code examples related to different libraries are each in their own module. Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-modules) we already have separate modules. Please make sure to have a look at the existing modules in such cases. ### Relevant articles - -- [Introduction to Javatuples](https://www.baeldung.com/java-tuples) -- [Introduction to Javassist](https://www.baeldung.com/javassist) -- [Introduction to Apache Flink with Java](https://www.baeldung.com/apache-flink) -- [Intro to JaVers](https://www.baeldung.com/javers) -- [Merging Streams in Java](https://www.baeldung.com/java-merge-streams) -- [Introduction to Quartz](https://www.baeldung.com/quartz) -- [How to Warm Up the JVM](https://www.baeldung.com/java-jvm-warmup) -- [Software Transactional Memory in Java Using Multiverse](https://www.baeldung.com/java-multiverse-stm) -- [Locality-Sensitive Hashing in Java Using Java-LSH](https://www.baeldung.com/locality-sensitive-hashing) -- [Introduction to Neuroph](https://www.baeldung.com/neuroph) - -#5 -- [Introduction to Caffeine](https://www.baeldung.com/java-caching-caffeine) -- [Introduction to StreamEx](https://www.baeldung.com/streamex) -- [A Docker Guide for Java](https://www.baeldung.com/docker-java-api) -- [Introduction to Akka Actors in Java](https://www.baeldung.com/akka-actors-java) -- [A Guide to Byte Buddy](https://www.baeldung.com/byte-buddy) -- [Introduction to jOOL](https://www.baeldung.com/jool) -- [Consumer Driven Contracts with Pact](https://www.baeldung.com/pact-junit-consumer-driven-contracts) -- [Introduction to Atlassian Fugue](https://www.baeldung.com/java-fugue) -- [Publish and Receive Messages with Nats Java Client](https://www.baeldung.com/nats-java-client) -- [Java Concurrency Utility with JCTools](https://www.baeldung.com/java-concurrency-jc-tools) - -#6 -- [Introduction to JavaPoet](https://www.baeldung.com/java-poet) -- [Guide to Resilience4j](https://www.baeldung.com/resilience4j) -- [Implementing a FTP-Client in Java](https://www.baeldung.com/java-ftp-client) -- [Introduction to Functional Java](https://www.baeldung.com/java-functional-library) -- [A Guide to the Reflections Library](https://www.baeldung.com/reflections-library) - -- [Exactly Once Processing in Kafka](https://www.baeldung.com/kafka-exactly-once) +- [Quick Guide to RSS with Rome](https://www.baeldung.com/rome-rss) +- [Introduction to PCollections](https://www.baeldung.com/java-pcollections) +- [Introduction to Eclipse Collections](https://www.baeldung.com/eclipse-collections) +- [DistinctBy in the Java Stream API](https://www.baeldung.com/java-streams-distinct-by) +- [Introduction to NoException](https://www.baeldung.com/no-exception) +- [Spring Yarg Integration](https://www.baeldung.com/spring-yarg) +- [Delete a Directory Recursively in Java](https://www.baeldung.com/java-delete-directory) +- [Guide to JDeferred](https://www.baeldung.com/jdeferred) +- [Introduction to MBassador](https://www.baeldung.com/mbassador) +- [Using Pairs in Java](https://www.baeldung.com/java-pairs) - More articles [[next -->]](/libraries-2) diff --git a/libraries-5/README.md b/libraries-5/README.md new file mode 100644 index 0000000000..f1e749b293 --- /dev/null +++ b/libraries-5/README.md @@ -0,0 +1,21 @@ +## Libraries-5 + +This module contains articles about various Java libraries. +These are small libraries that are relatively easy to use and do not require any separate module of their own. + +The code examples related to different libraries are each in their own module. + +Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-modules) we already have separate modules. Please make sure to have a look at the existing modules in such cases. + +### Relevant articles +- [Introduction to Caffeine](https://www.baeldung.com/java-caching-caffeine) +- [Introduction to StreamEx](https://www.baeldung.com/streamex) +- [A Docker Guide for Java](https://www.baeldung.com/docker-java-api) +- [Introduction to Akka Actors in Java](https://www.baeldung.com/akka-actors-java) +- [A Guide to Byte Buddy](https://www.baeldung.com/byte-buddy) +- [Introduction to jOOL](https://www.baeldung.com/jool) +- [Consumer Driven Contracts with Pact](https://www.baeldung.com/pact-junit-consumer-driven-contracts) +- [Introduction to Atlassian Fugue](https://www.baeldung.com/java-fugue) +- [Publish and Receive Messages with Nats Java Client](https://www.baeldung.com/nats-java-client) +- [Java Concurrency Utility with JCTools](https://www.baeldung.com/java-concurrency-jc-tools) +- More articles [[<-- prev]](/libraries-4) [[next -->]](/libraries-6) diff --git a/libraries-5/pom.xml b/libraries-5/pom.xml index b5a1ecd49c..41c92e54c3 100644 --- a/libraries-5/pom.xml +++ b/libraries-5/pom.xml @@ -7,9 +7,139 @@ com.baeldung 1.0.0-SNAPSHOT - 4.0.0 libraries-5 + 4.0.0 + + + org.springframework + spring-web + ${spring.version} + + + org.assertj + assertj-core + ${assertj.version} + + + org.jooq + jool + ${jool.version} + + + au.com.dius + pact-jvm-consumer-junit_2.11 + ${pact.version} + test + + + org.codehaus.groovy + groovy-all + + + + + + + com.typesafe.akka + akka-actor_2.12 + ${typesafe-akka.version} + + + com.typesafe.akka + akka-testkit_2.12 + ${typesafe-akka.version} + test + + + + one.util + streamex + ${streamex.version} + + + net.bytebuddy + byte-buddy + ${bytebuddy.version} + + + net.bytebuddy + byte-buddy-agent + ${bytebuddy.version} + + + + + com.github.docker-java + docker-java + ${docker.version} + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + jcl-over-slf4j + + + ch.qos.logback + logback-classic + + + + + + + com.github.ben-manes.caffeine + caffeine + ${caffeine.version} + + + com.google.code.findbugs + jsr305 + ${findbugs.version} + test + + + + io.atlassian.fugue + fugue + ${fugue.version} + + + io.nats + jnats + ${jnats.version} + + + org.jctools + jctools-core + ${jctools.version} + + + org.openjdk.jmh + jmh-core + ${jmh.version} + + + + + 3.5.0 + 0.9.12 + 4.3.8.RELEASE + 3.6.2 + 2.5.26 + 0.6.5 + 1.7.1 + 3.0.14 + 2.5.5 + 3.0.2 + 4.5.1 + 1.0 + 2.1.2 + 1.19 + \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/akka/FirstActor.java b/libraries-5/src/main/java/com/baeldung/akka/FirstActor.java similarity index 100% rename from libraries/src/main/java/com/baeldung/akka/FirstActor.java rename to libraries-5/src/main/java/com/baeldung/akka/FirstActor.java diff --git a/libraries/src/main/java/com/baeldung/akka/MyActor.java b/libraries-5/src/main/java/com/baeldung/akka/MyActor.java similarity index 100% rename from libraries/src/main/java/com/baeldung/akka/MyActor.java rename to libraries-5/src/main/java/com/baeldung/akka/MyActor.java diff --git a/libraries/src/main/java/com/baeldung/akka/PrinterActor.java b/libraries-5/src/main/java/com/baeldung/akka/PrinterActor.java similarity index 100% rename from libraries/src/main/java/com/baeldung/akka/PrinterActor.java rename to libraries-5/src/main/java/com/baeldung/akka/PrinterActor.java diff --git a/libraries/src/main/java/com/baeldung/akka/ReadingActor.java b/libraries-5/src/main/java/com/baeldung/akka/ReadingActor.java similarity index 100% rename from libraries/src/main/java/com/baeldung/akka/ReadingActor.java rename to libraries-5/src/main/java/com/baeldung/akka/ReadingActor.java diff --git a/libraries/src/main/java/com/baeldung/akka/WordCounterActor.java b/libraries-5/src/main/java/com/baeldung/akka/WordCounterActor.java similarity index 100% rename from libraries/src/main/java/com/baeldung/akka/WordCounterActor.java rename to libraries-5/src/main/java/com/baeldung/akka/WordCounterActor.java diff --git a/libraries/src/main/java/com/baeldung/bytebuddy/Bar.java b/libraries-5/src/main/java/com/baeldung/bytebuddy/Bar.java similarity index 100% rename from libraries/src/main/java/com/baeldung/bytebuddy/Bar.java rename to libraries-5/src/main/java/com/baeldung/bytebuddy/Bar.java diff --git a/libraries/src/main/java/com/baeldung/bytebuddy/Foo.java b/libraries-5/src/main/java/com/baeldung/bytebuddy/Foo.java similarity index 100% rename from libraries/src/main/java/com/baeldung/bytebuddy/Foo.java rename to libraries-5/src/main/java/com/baeldung/bytebuddy/Foo.java diff --git a/libraries/src/main/java/com/baeldung/caffeine/DataObject.java b/libraries-5/src/main/java/com/baeldung/caffeine/DataObject.java similarity index 100% rename from libraries/src/main/java/com/baeldung/caffeine/DataObject.java rename to libraries-5/src/main/java/com/baeldung/caffeine/DataObject.java diff --git a/libraries/src/main/java/com/baeldung/jctools/MpmcBenchmark.java b/libraries-5/src/main/java/com/baeldung/jctools/MpmcBenchmark.java similarity index 100% rename from libraries/src/main/java/com/baeldung/jctools/MpmcBenchmark.java rename to libraries-5/src/main/java/com/baeldung/jctools/MpmcBenchmark.java diff --git a/libraries/src/main/java/com/baeldung/jctools/README.md b/libraries-5/src/main/java/com/baeldung/jctools/README.md similarity index 100% rename from libraries/src/main/java/com/baeldung/jctools/README.md rename to libraries-5/src/main/java/com/baeldung/jctools/README.md diff --git a/libraries/src/main/java/com/baeldung/jnats/NatsClient.java b/libraries-5/src/main/java/com/baeldung/jnats/NatsClient.java similarity index 100% rename from libraries/src/main/java/com/baeldung/jnats/NatsClient.java rename to libraries-5/src/main/java/com/baeldung/jnats/NatsClient.java diff --git a/libraries/src/main/java/com/baeldung/streamex/Role.java b/libraries-5/src/main/java/com/baeldung/streamex/Role.java similarity index 100% rename from libraries/src/main/java/com/baeldung/streamex/Role.java rename to libraries-5/src/main/java/com/baeldung/streamex/Role.java diff --git a/libraries/src/main/java/com/baeldung/streamex/StreamEX.java b/libraries-5/src/main/java/com/baeldung/streamex/StreamEX.java similarity index 100% rename from libraries/src/main/java/com/baeldung/streamex/StreamEX.java rename to libraries-5/src/main/java/com/baeldung/streamex/StreamEX.java diff --git a/libraries/src/main/java/com/baeldung/streamex/User.java b/libraries-5/src/main/java/com/baeldung/streamex/User.java similarity index 100% rename from libraries/src/main/java/com/baeldung/streamex/User.java rename to libraries-5/src/main/java/com/baeldung/streamex/User.java diff --git a/libraries/src/test/java/com/baeldung/akka/AkkaActorsUnitTest.java b/libraries-5/src/test/java/com/baeldung/akka/AkkaActorsUnitTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/akka/AkkaActorsUnitTest.java rename to libraries-5/src/test/java/com/baeldung/akka/AkkaActorsUnitTest.java diff --git a/libraries/src/test/java/com/baeldung/bytebuddy/ByteBuddyUnitTest.java b/libraries-5/src/test/java/com/baeldung/bytebuddy/ByteBuddyUnitTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/bytebuddy/ByteBuddyUnitTest.java rename to libraries-5/src/test/java/com/baeldung/bytebuddy/ByteBuddyUnitTest.java diff --git a/libraries/src/test/java/com/baeldung/caffeine/CaffeineUnitTest.java b/libraries-5/src/test/java/com/baeldung/caffeine/CaffeineUnitTest.java similarity index 88% rename from libraries/src/test/java/com/baeldung/caffeine/CaffeineUnitTest.java rename to libraries-5/src/test/java/com/baeldung/caffeine/CaffeineUnitTest.java index d523d0ff8b..65c441c50d 100644 --- a/libraries/src/test/java/com/baeldung/caffeine/CaffeineUnitTest.java +++ b/libraries-5/src/test/java/com/baeldung/caffeine/CaffeineUnitTest.java @@ -8,6 +8,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Nonnull; +import org.junit.Assert; import org.junit.Test; import com.github.benmanes.caffeine.cache.*; @@ -65,43 +66,43 @@ public class CaffeineUnitTest { assertEquals("Data for " + key, dataObject.getData()); }); - cache.getAll(Arrays.asList("A", "B", "C")).thenAccept(dataObjectMap -> assertEquals(3, dataObjectMap.size())); + cache.getAll(Arrays.asList("A", "B", "C")).thenAccept(dataObjectMap -> Assert.assertEquals(3, dataObjectMap.size())); } @Test public void givenLoadingCacheWithSmallSize_whenPut_thenSizeIsConstant() { LoadingCache cache = Caffeine.newBuilder().maximumSize(1).refreshAfterWrite(10, TimeUnit.MINUTES).build(k -> DataObject.get("Data for " + k)); - assertEquals(0, cache.estimatedSize()); + Assert.assertEquals(0, cache.estimatedSize()); cache.get("A"); - assertEquals(1, cache.estimatedSize()); + Assert.assertEquals(1, cache.estimatedSize()); cache.get("B"); cache.cleanUp(); - assertEquals(1, cache.estimatedSize()); + Assert.assertEquals(1, cache.estimatedSize()); } @Test public void givenLoadingCacheWithWeigher_whenPut_thenSizeIsConstant() { LoadingCache cache = Caffeine.newBuilder().maximumWeight(10).weigher((k, v) -> 5).build(k -> DataObject.get("Data for " + k)); - assertEquals(0, cache.estimatedSize()); + Assert.assertEquals(0, cache.estimatedSize()); cache.get("A"); - assertEquals(1, cache.estimatedSize()); + Assert.assertEquals(1, cache.estimatedSize()); cache.get("B"); - assertEquals(2, cache.estimatedSize()); + Assert.assertEquals(2, cache.estimatedSize()); cache.get("C"); cache.cleanUp(); - assertEquals(2, cache.estimatedSize()); + Assert.assertEquals(2, cache.estimatedSize()); } @Test @@ -138,7 +139,7 @@ public class CaffeineUnitTest { cache.get("A"); cache.get("A"); - assertEquals(1, cache.stats().hitCount()); - assertEquals(1, cache.stats().missCount()); + Assert.assertEquals(1, cache.stats().hitCount()); + Assert.assertEquals(1, cache.stats().missCount()); } } \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/dockerapi/ContainerLiveTest.java b/libraries-5/src/test/java/com/baeldung/dockerapi/ContainerLiveTest.java similarity index 94% rename from libraries/src/test/java/com/baeldung/dockerapi/ContainerLiveTest.java rename to libraries-5/src/test/java/com/baeldung/dockerapi/ContainerLiveTest.java index e6f0fd1c31..007c70355a 100644 --- a/libraries/src/test/java/com/baeldung/dockerapi/ContainerLiveTest.java +++ b/libraries-5/src/test/java/com/baeldung/dockerapi/ContainerLiveTest.java @@ -6,6 +6,8 @@ import com.github.dockerjava.api.command.InspectContainerResponse; import com.github.dockerjava.api.model.Container; import com.github.dockerjava.api.model.PortBinding; import com.github.dockerjava.core.DockerClientBuilder; +import org.hamcrest.MatcherAssert; +import org.hamcrest.core.Is; import org.junit.BeforeClass; import org.junit.Test; @@ -51,7 +53,7 @@ public class ContainerLiveTest { CreateContainerResponse container = dockerClient.createContainerCmd("mongo:3.6").withCmd("--bind_ip_all").withName("mongo").withHostName("baeldung").withEnv("MONGO_LATEST_VERSION=3.6").withPortBindings(PortBinding.parse("9999:27017")).exec(); // then - assertThat(container.getId(), is(not(null))); + MatcherAssert.assertThat(container.getId(), is(not(null))); } @Test @@ -104,7 +106,7 @@ public class ContainerLiveTest { // then InspectContainerResponse containerResponse = dockerClient.inspectContainerCmd(container.getId()).exec(); - assertThat(containerResponse.getId(), is(container.getId())); + MatcherAssert.assertThat(containerResponse.getId(), Is.is(container.getId())); } @Test diff --git a/libraries/src/test/java/com/baeldung/dockerapi/DockerClientLiveTest.java b/libraries-5/src/test/java/com/baeldung/dockerapi/DockerClientLiveTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/dockerapi/DockerClientLiveTest.java rename to libraries-5/src/test/java/com/baeldung/dockerapi/DockerClientLiveTest.java diff --git a/libraries/src/test/java/com/baeldung/dockerapi/ImageLiveTest.java b/libraries-5/src/test/java/com/baeldung/dockerapi/ImageLiveTest.java similarity index 96% rename from libraries/src/test/java/com/baeldung/dockerapi/ImageLiveTest.java rename to libraries-5/src/test/java/com/baeldung/dockerapi/ImageLiveTest.java index 7e8cd6a354..96e7922f2a 100644 --- a/libraries/src/test/java/com/baeldung/dockerapi/ImageLiveTest.java +++ b/libraries-5/src/test/java/com/baeldung/dockerapi/ImageLiveTest.java @@ -8,6 +8,8 @@ import com.github.dockerjava.core.DockerClientBuilder; import com.github.dockerjava.core.command.BuildImageResultCallback; import com.github.dockerjava.core.command.PullImageResultCallback; import com.github.dockerjava.core.command.PushImageResultCallback; +import org.hamcrest.MatcherAssert; +import org.hamcrest.core.Is; import org.junit.BeforeClass; import org.junit.Test; @@ -81,7 +83,7 @@ public class ImageLiveTest { InspectImageResponse imageResponse = dockerClient.inspectImageCmd(image.getId()).exec(); // then - assertThat(imageResponse.getId(), is(image.getId())); + MatcherAssert.assertThat(imageResponse.getId(), Is.is(image.getId())); } @Test diff --git a/libraries/src/test/java/com/baeldung/dockerapi/NetworkLiveTest.java b/libraries-5/src/test/java/com/baeldung/dockerapi/NetworkLiveTest.java similarity index 95% rename from libraries/src/test/java/com/baeldung/dockerapi/NetworkLiveTest.java rename to libraries-5/src/test/java/com/baeldung/dockerapi/NetworkLiveTest.java index d3abbe2e7e..31ad32c7b5 100644 --- a/libraries/src/test/java/com/baeldung/dockerapi/NetworkLiveTest.java +++ b/libraries-5/src/test/java/com/baeldung/dockerapi/NetworkLiveTest.java @@ -5,6 +5,7 @@ import com.github.dockerjava.api.command.CreateNetworkResponse; import com.github.dockerjava.api.model.Network; import com.github.dockerjava.api.model.Network.Ipam; import com.github.dockerjava.core.DockerClientBuilder; +import org.hamcrest.MatcherAssert; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; @@ -64,7 +65,7 @@ public class NetworkLiveTest { Network network = dockerClient.inspectNetworkCmd().withNetworkId(networkName).exec(); // then - assertThat(network.getName(), is(networkName)); + MatcherAssert.assertThat(network.getName(), is(networkName)); } @Test diff --git a/libraries/src/test/java/com/baeldung/dockerapi/VolumeLiveTest.java b/libraries-5/src/test/java/com/baeldung/dockerapi/VolumeLiveTest.java similarity index 92% rename from libraries/src/test/java/com/baeldung/dockerapi/VolumeLiveTest.java rename to libraries-5/src/test/java/com/baeldung/dockerapi/VolumeLiveTest.java index 9e60a76b33..f2a078b2c6 100644 --- a/libraries/src/test/java/com/baeldung/dockerapi/VolumeLiveTest.java +++ b/libraries-5/src/test/java/com/baeldung/dockerapi/VolumeLiveTest.java @@ -5,6 +5,7 @@ import com.github.dockerjava.api.command.CreateVolumeResponse; import com.github.dockerjava.api.command.InspectVolumeResponse; import com.github.dockerjava.api.command.ListVolumesResponse; import com.github.dockerjava.core.DockerClientBuilder; +import org.hamcrest.MatcherAssert; import org.junit.BeforeClass; import org.junit.Test; @@ -57,7 +58,7 @@ public class VolumeLiveTest { CreateVolumeResponse unnamedVolume = dockerClient.createVolumeCmd().exec(); // then - assertThat(unnamedVolume.getName(), is(not(null))); + MatcherAssert.assertThat(unnamedVolume.getName(), is(not(null))); } @Test @@ -67,7 +68,7 @@ public class VolumeLiveTest { CreateVolumeResponse namedVolume = dockerClient.createVolumeCmd().withName("myNamedVolume").exec(); // then - assertThat(namedVolume.getName(), is(not(null))); + MatcherAssert.assertThat(namedVolume.getName(), is(not(null))); } @Test diff --git a/libraries/src/test/java/com/baeldung/atlassian/fugue/FugueUnitTest.java b/libraries-5/src/test/java/com/baeldung/fugue/FugueUnitTest.java similarity index 99% rename from libraries/src/test/java/com/baeldung/atlassian/fugue/FugueUnitTest.java rename to libraries-5/src/test/java/com/baeldung/fugue/FugueUnitTest.java index 773e39b76a..c3a89a1355 100644 --- a/libraries/src/test/java/com/baeldung/atlassian/fugue/FugueUnitTest.java +++ b/libraries-5/src/test/java/com/baeldung/fugue/FugueUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.atlassian.fugue; +package com.baeldung.fugue; import io.atlassian.fugue.*; import org.junit.Assert; diff --git a/libraries/src/test/java/com/baeldung/jctools/JCToolsUnitTest.java b/libraries-5/src/test/java/com/baeldung/jctools/JCToolsUnitTest.java similarity index 88% rename from libraries/src/test/java/com/baeldung/jctools/JCToolsUnitTest.java rename to libraries-5/src/test/java/com/baeldung/jctools/JCToolsUnitTest.java index 4a9d0fadb2..a5dacdbdac 100644 --- a/libraries/src/test/java/com/baeldung/jctools/JCToolsUnitTest.java +++ b/libraries-5/src/test/java/com/baeldung/jctools/JCToolsUnitTest.java @@ -1,5 +1,6 @@ package com.baeldung.jctools; +import org.assertj.core.api.Assertions; import org.jctools.queues.SpscArrayQueue; import org.jctools.queues.SpscChunkedArrayQueue; import org.junit.Test; @@ -44,16 +45,16 @@ public class JCToolsUnitTest { @Test public void whenQueueIsFull_thenNoMoreElementsCanBeAdded() throws InterruptedException { SpscChunkedArrayQueue queue = new SpscChunkedArrayQueue<>(8, 16); - assertThat(queue.capacity()).isEqualTo(16); + Assertions.assertThat(queue.capacity()).isEqualTo(16); CountDownLatch startConsuming = new CountDownLatch(1); CountDownLatch awakeProducer = new CountDownLatch(1); AtomicReference error = new AtomicReference<>(); Thread producer = new Thread(() -> { IntStream.range(0, queue.capacity()).forEach(i -> { - assertThat(queue.offer(i)).isTrue(); + Assertions.assertThat(queue.offer(i)).isTrue(); }); - assertThat(queue.offer(queue.capacity())).isFalse(); + Assertions.assertThat(queue.offer(queue.capacity())).isFalse(); startConsuming.countDown(); try { awakeProducer.await(); @@ -61,7 +62,7 @@ public class JCToolsUnitTest { throw new RuntimeException(e); } - assertThat(queue.offer(queue.capacity())).isTrue(); + Assertions.assertThat(queue.offer(queue.capacity())).isTrue(); }); producer.setUncaughtExceptionHandler((t, e) -> { error.set(e); diff --git a/libraries/src/test/java/com/baeldung/jnats/NatsClientLiveTest.java b/libraries-5/src/test/java/com/baeldung/jnats/NatsClientLiveTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/jnats/NatsClientLiveTest.java rename to libraries-5/src/test/java/com/baeldung/jnats/NatsClientLiveTest.java diff --git a/libraries/src/test/java/com/baeldung/jool/JOOLUnitTest.java b/libraries-5/src/test/java/com/baeldung/jool/JOOLUnitTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/jool/JOOLUnitTest.java rename to libraries-5/src/test/java/com/baeldung/jool/JOOLUnitTest.java diff --git a/libraries/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java b/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java rename to libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java diff --git a/libraries/src/test/java/com/baeldung/stream/StreamExMergeStreamsUnitTest.java b/libraries-5/src/test/java/com/baeldung/streamex/StreamExMergeStreamsUnitTest.java similarity index 98% rename from libraries/src/test/java/com/baeldung/stream/StreamExMergeStreamsUnitTest.java rename to libraries-5/src/test/java/com/baeldung/streamex/StreamExMergeStreamsUnitTest.java index 220348bf36..b267eaea9b 100644 --- a/libraries/src/test/java/com/baeldung/stream/StreamExMergeStreamsUnitTest.java +++ b/libraries-5/src/test/java/com/baeldung/streamex/StreamExMergeStreamsUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.stream; +package com.baeldung.streamex; import one.util.streamex.StreamEx; import org.junit.Test; diff --git a/libraries/src/test/resources/dockerapi/Dockerfile b/libraries-5/src/test/resources/dockerapi/Dockerfile similarity index 100% rename from libraries/src/test/resources/dockerapi/Dockerfile rename to libraries-5/src/test/resources/dockerapi/Dockerfile diff --git a/libraries-6/README.md b/libraries-6/README.md new file mode 100644 index 0000000000..79bb83113e --- /dev/null +++ b/libraries-6/README.md @@ -0,0 +1,17 @@ +## Libraries-6 + +This module contains articles about various Java libraries. +These are small libraries that are relatively easy to use and do not require any separate module of their own. + +The code examples related to different libraries are each in their own module. + +Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-modules) we already have separate modules. Please make sure to have a look at the existing modules in such cases. + +### Relevant articles +- [Introduction to JavaPoet](https://www.baeldung.com/java-poet) +- [Guide to Resilience4j](https://www.baeldung.com/resilience4j) +- [Implementing a FTP-Client in Java](https://www.baeldung.com/java-ftp-client) +- [Introduction to Functional Java](https://www.baeldung.com/java-functional-library) +- [A Guide to the Reflections Library](https://www.baeldung.com/reflections-library) +- [Exactly Once Processing in Kafka](https://www.baeldung.com/kafka-exactly-once) +- More articles [[<-- prev]](/libraries-5) diff --git a/libraries-6/pom.xml b/libraries-6/pom.xml index be74ff9ef0..030e5aa77b 100644 --- a/libraries-6/pom.xml +++ b/libraries-6/pom.xml @@ -11,5 +11,101 @@ libraries-6 + + + org.functionaljava + functionaljava-java8 + ${functionaljava.version} + + + com.codepoetics + protonpack + ${protonpack.version} + + + org.apache.kafka + kafka-streams + ${kafka.version} + + + org.apache.kafka + kafka-clients + ${kafka.version} + test + test + + + io.github.resilience4j + resilience4j-circuitbreaker + ${resilience4j.version} + + + io.github.resilience4j + resilience4j-bulkhead + ${resilience4j.version} + + + io.github.resilience4j + resilience4j-retry + ${resilience4j.version} + + + io.github.resilience4j + resilience4j-timelimiter + ${resilience4j.version} + + + com.squareup + javapoet + ${javapoet.version} + + + org.mockftpserver + MockFtpServer + ${mockftpserver.version} + test + + + + org.reflections + reflections + ${reflections.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + commons-net + commons-net + ${commons-net.version} + + + org.assertj + assertj-core + ${assertj.version} + + + commons-io + commons-io + ${commonsio.version} + test + + + + + 2.0.0 + 1.10.0 + 0.9.11 + 2.7.1 + 4.8.1 + 0.12.1 + 1.15 + 3.6 + 3.6.2 + 2.6 + + \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/fj/FunctionalJavaIOMain.java b/libraries-6/src/main/java/com/baeldung/fj/FunctionalJavaIOMain.java similarity index 96% rename from libraries/src/main/java/com/baeldung/fj/FunctionalJavaIOMain.java rename to libraries-6/src/main/java/com/baeldung/fj/FunctionalJavaIOMain.java index eaa201d1ba..e97f128b30 100644 --- a/libraries/src/main/java/com/baeldung/fj/FunctionalJavaIOMain.java +++ b/libraries-6/src/main/java/com/baeldung/fj/FunctionalJavaIOMain.java @@ -1,43 +1,43 @@ -package com.baeldung.fj; - -import fj.F; -import fj.F1Functions; -import fj.Unit; -import fj.data.IO; -import fj.data.IOFunctions; - -public class FunctionalJavaIOMain { - - public static IO printLetters(final String s) { - return () -> { - for (int i = 0; i < s.length(); i++) { - System.out.println(s.charAt(i)); - } - return Unit.unit(); - }; - } - - public static void main(String[] args) { - - F> printLetters = i -> printLetters(i); - - IO lowerCase = IOFunctions.stdoutPrintln("What's your first Name ?"); - - IO input = IOFunctions.stdoutPrint("First Name: "); - - IO userInput = IOFunctions.append(lowerCase, input); - - IO readInput = IOFunctions.stdinReadLine(); - - F toUpperCase = i -> i.toUpperCase(); - - F> transformInput = F1Functions., String> o(printLetters).f(toUpperCase); - - IO readAndPrintResult = IOFunctions.bind(readInput, transformInput); - - IO program = IOFunctions.bind(userInput, nothing -> readAndPrintResult); - - IOFunctions.toSafe(program).run(); - - } -} +package com.baeldung.fj; + +import fj.F; +import fj.F1Functions; +import fj.Unit; +import fj.data.IO; +import fj.data.IOFunctions; + +public class FunctionalJavaIOMain { + + public static IO printLetters(final String s) { + return () -> { + for (int i = 0; i < s.length(); i++) { + System.out.println(s.charAt(i)); + } + return Unit.unit(); + }; + } + + public static void main(String[] args) { + + F> printLetters = i -> printLetters(i); + + IO lowerCase = IOFunctions.stdoutPrintln("What's your first Name ?"); + + IO input = IOFunctions.stdoutPrint("First Name: "); + + IO userInput = IOFunctions.append(lowerCase, input); + + IO readInput = IOFunctions.stdinReadLine(); + + F toUpperCase = i -> i.toUpperCase(); + + F> transformInput = F1Functions., String> o(printLetters).f(toUpperCase); + + IO readAndPrintResult = IOFunctions.bind(readInput, transformInput); + + IO program = IOFunctions.bind(userInput, nothing -> readAndPrintResult); + + IOFunctions.toSafe(program).run(); + + } +} diff --git a/libraries/src/main/java/com/baeldung/fj/FunctionalJavaMain.java b/libraries-6/src/main/java/com/baeldung/fj/FunctionalJavaMain.java similarity index 96% rename from libraries/src/main/java/com/baeldung/fj/FunctionalJavaMain.java rename to libraries-6/src/main/java/com/baeldung/fj/FunctionalJavaMain.java index c6412f2923..1a59e6c22a 100644 --- a/libraries/src/main/java/com/baeldung/fj/FunctionalJavaMain.java +++ b/libraries-6/src/main/java/com/baeldung/fj/FunctionalJavaMain.java @@ -1,48 +1,48 @@ -package com.baeldung.fj; - -import fj.F; -import fj.Show; -import fj.data.Array; -import fj.data.List; -import fj.data.Option; -import fj.function.Characters; -import fj.function.Integers; - -public class FunctionalJavaMain { - - public static final F isEven = i -> i % 2 == 0; - - public static void main(String[] args) { - - List fList = List.list(3, 4, 5, 6); - List evenList = fList.map(isEven); - Show.listShow(Show.booleanShow).println(evenList); - - fList = fList.map(i -> i + 1); - Show.listShow(Show.intShow).println(fList); - - Array a = Array.array(17, 44, 67, 2, 22, 80, 1, 27); - Array b = a.filter(Integers.even); - Show.arrayShow(Show.intShow).println(b); - - Array array = Array.array("Welcome", "To", "baeldung"); - Boolean isExist = array.exists(s -> List.fromString(s).forall(Characters.isLowerCase)); - System.out.println(isExist); - - Array intArray = Array.array(17, 44, 67, 2, 22, 80, 1, 27); - int sum = intArray.foldLeft(Integers.add, 0); - System.out.println(sum); - - Option n1 = Option.some(1); - Option n2 = Option.some(2); - - F> f1 = i -> i % 2 == 0 ? Option.some(i + 100) : Option.none(); - - Option result1 = n1.bind(f1); - Option result2 = n2.bind(f1); - - Show.optionShow(Show.intShow).println(result1); - Show.optionShow(Show.intShow).println(result2); - } - -} +package com.baeldung.fj; + +import fj.F; +import fj.Show; +import fj.data.Array; +import fj.data.List; +import fj.data.Option; +import fj.function.Characters; +import fj.function.Integers; + +public class FunctionalJavaMain { + + public static final F isEven = i -> i % 2 == 0; + + public static void main(String[] args) { + + List fList = List.list(3, 4, 5, 6); + List evenList = fList.map(isEven); + Show.listShow(Show.booleanShow).println(evenList); + + fList = fList.map(i -> i + 1); + Show.listShow(Show.intShow).println(fList); + + Array a = Array.array(17, 44, 67, 2, 22, 80, 1, 27); + Array b = a.filter(Integers.even); + Show.arrayShow(Show.intShow).println(b); + + Array array = Array.array("Welcome", "To", "baeldung"); + Boolean isExist = array.exists(s -> List.fromString(s).forall(Characters.isLowerCase)); + System.out.println(isExist); + + Array intArray = Array.array(17, 44, 67, 2, 22, 80, 1, 27); + int sum = intArray.foldLeft(Integers.add, 0); + System.out.println(sum); + + Option n1 = Option.some(1); + Option n2 = Option.some(2); + + F> f1 = i -> i % 2 == 0 ? Option.some(i + 100) : Option.none(); + + Option result1 = n1.bind(f1); + Option result2 = n2.bind(f1); + + Show.optionShow(Show.intShow).println(result1); + Show.optionShow(Show.intShow).println(result2); + } + +} diff --git a/libraries/src/main/java/com/baeldung/ftp/FtpClient.java b/libraries-6/src/main/java/com/baeldung/ftp/FtpClient.java similarity index 100% rename from libraries/src/main/java/com/baeldung/ftp/FtpClient.java rename to libraries-6/src/main/java/com/baeldung/ftp/FtpClient.java diff --git a/libraries/src/main/java/com/baeldung/javapoet/PersonGenerator.java b/libraries-6/src/main/java/com/baeldung/javapoet/PersonGenerator.java similarity index 100% rename from libraries/src/main/java/com/baeldung/javapoet/PersonGenerator.java rename to libraries-6/src/main/java/com/baeldung/javapoet/PersonGenerator.java diff --git a/libraries/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java b/libraries-6/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java similarity index 100% rename from libraries/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java rename to libraries-6/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java diff --git a/libraries/src/main/java/com/baeldung/kafka/TransactionalWordCount.java b/libraries-6/src/main/java/com/baeldung/kafka/TransactionalWordCount.java similarity index 100% rename from libraries/src/main/java/com/baeldung/kafka/TransactionalWordCount.java rename to libraries-6/src/main/java/com/baeldung/kafka/TransactionalWordCount.java diff --git a/libraries/src/main/java/com/baeldung/kafka/Tuple.java b/libraries-6/src/main/java/com/baeldung/kafka/Tuple.java similarity index 100% rename from libraries/src/main/java/com/baeldung/kafka/Tuple.java rename to libraries-6/src/main/java/com/baeldung/kafka/Tuple.java diff --git a/libraries/src/main/java/com/baeldung/reflections/ReflectionsApp.java b/libraries-6/src/main/java/com/baeldung/reflections/ReflectionsApp.java similarity index 97% rename from libraries/src/main/java/com/baeldung/reflections/ReflectionsApp.java rename to libraries-6/src/main/java/com/baeldung/reflections/ReflectionsApp.java index 30da8ea837..4f5b6dd183 100644 --- a/libraries/src/main/java/com/baeldung/reflections/ReflectionsApp.java +++ b/libraries-6/src/main/java/com/baeldung/reflections/ReflectionsApp.java @@ -1,71 +1,71 @@ -package com.baeldung.reflections; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.Date; -import java.util.Set; -import java.util.regex.Pattern; - -import org.reflections.Reflections; -import org.reflections.scanners.MethodAnnotationsScanner; -import org.reflections.scanners.MethodParameterScanner; -import org.reflections.scanners.ResourcesScanner; -import org.reflections.scanners.Scanner; -import org.reflections.scanners.SubTypesScanner; -import org.reflections.util.ClasspathHelper; -import org.reflections.util.ConfigurationBuilder; - -public class ReflectionsApp { - - public Set> getReflectionsSubTypes() { - Reflections reflections = new Reflections("org.reflections"); - Set> scannersSet = reflections.getSubTypesOf(Scanner.class); - return scannersSet; - } - - public Set> getJDKFunctinalInterfaces() { - Reflections reflections = new Reflections("java.util.function"); - Set> typesSet = reflections.getTypesAnnotatedWith(FunctionalInterface.class); - return typesSet; - } - - public Set getDateDeprecatedMethods() { - Reflections reflections = new Reflections(java.util.Date.class, new MethodAnnotationsScanner()); - Set deprecatedMethodsSet = reflections.getMethodsAnnotatedWith(Deprecated.class); - return deprecatedMethodsSet; - } - - @SuppressWarnings("rawtypes") - public Set getDateDeprecatedConstructors() { - Reflections reflections = new Reflections(java.util.Date.class, new MethodAnnotationsScanner()); - Set constructorsSet = reflections.getConstructorsAnnotatedWith(Deprecated.class); - return constructorsSet; - } - - public Set getMethodsWithDateParam() { - Reflections reflections = new Reflections(java.text.SimpleDateFormat.class, new MethodParameterScanner()); - Set methodsSet = reflections.getMethodsMatchParams(Date.class); - return methodsSet; - } - - public Set getMethodsWithVoidReturn() { - Reflections reflections = new Reflections(java.text.SimpleDateFormat.class, new MethodParameterScanner()); - Set methodsSet = reflections.getMethodsReturn(void.class); - return methodsSet; - } - - public Set getPomXmlPaths() { - Reflections reflections = new Reflections(new ResourcesScanner()); - Set resourcesSet = reflections.getResources(Pattern.compile(".*pom\\.xml")); - return resourcesSet; - } - - public Set> getReflectionsSubTypesUsingBuilder() { - Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("org.reflections")) - .setScanners(new SubTypesScanner())); - - Set> scannersSet = reflections.getSubTypesOf(Scanner.class); - return scannersSet; - } - -} +package com.baeldung.reflections; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.util.Date; +import java.util.Set; +import java.util.regex.Pattern; + +import org.reflections.Reflections; +import org.reflections.scanners.MethodAnnotationsScanner; +import org.reflections.scanners.MethodParameterScanner; +import org.reflections.scanners.ResourcesScanner; +import org.reflections.scanners.Scanner; +import org.reflections.scanners.SubTypesScanner; +import org.reflections.util.ClasspathHelper; +import org.reflections.util.ConfigurationBuilder; + +public class ReflectionsApp { + + public Set> getReflectionsSubTypes() { + Reflections reflections = new Reflections("org.reflections"); + Set> scannersSet = reflections.getSubTypesOf(Scanner.class); + return scannersSet; + } + + public Set> getJDKFunctinalInterfaces() { + Reflections reflections = new Reflections("java.util.function"); + Set> typesSet = reflections.getTypesAnnotatedWith(FunctionalInterface.class); + return typesSet; + } + + public Set getDateDeprecatedMethods() { + Reflections reflections = new Reflections(java.util.Date.class, new MethodAnnotationsScanner()); + Set deprecatedMethodsSet = reflections.getMethodsAnnotatedWith(Deprecated.class); + return deprecatedMethodsSet; + } + + @SuppressWarnings("rawtypes") + public Set getDateDeprecatedConstructors() { + Reflections reflections = new Reflections(java.util.Date.class, new MethodAnnotationsScanner()); + Set constructorsSet = reflections.getConstructorsAnnotatedWith(Deprecated.class); + return constructorsSet; + } + + public Set getMethodsWithDateParam() { + Reflections reflections = new Reflections(java.text.SimpleDateFormat.class, new MethodParameterScanner()); + Set methodsSet = reflections.getMethodsMatchParams(Date.class); + return methodsSet; + } + + public Set getMethodsWithVoidReturn() { + Reflections reflections = new Reflections(java.text.SimpleDateFormat.class, new MethodParameterScanner()); + Set methodsSet = reflections.getMethodsReturn(void.class); + return methodsSet; + } + + public Set getPomXmlPaths() { + Reflections reflections = new Reflections(new ResourcesScanner()); + Set resourcesSet = reflections.getResources(Pattern.compile(".*pom\\.xml")); + return resourcesSet; + } + + public Set> getReflectionsSubTypesUsingBuilder() { + Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("org.reflections")) + .setScanners(new SubTypesScanner())); + + Set> scannersSet = reflections.getSubTypesOf(Scanner.class); + return scannersSet; + } + +} diff --git a/libraries/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java b/libraries-6/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java similarity index 95% rename from libraries/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java rename to libraries-6/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java index 97ead07470..f79d334b23 100644 --- a/libraries/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java +++ b/libraries-6/src/test/java/com/baeldung/fj/FunctionalJavaUnitTest.java @@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.junit.Assert; import org.junit.Test; import fj.F; @@ -96,9 +97,9 @@ public class FunctionalJavaUnitTest { Option result2 = n2.bind(function); Option result3 = n3.bind(function); - assertEquals(Option.none(), result1); - assertEquals(Option.some(102), result2); - assertEquals(Option.none(), result3); + Assert.assertEquals(Option.none(), result1); + Assert.assertEquals(Option.some(102), result2); + Assert.assertEquals(Option.none(), result3); } @Test diff --git a/libraries/src/test/java/com/baeldung/ftp/FtpClientIntegrationTest.java b/libraries-6/src/test/java/com/baeldung/ftp/FtpClientIntegrationTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/ftp/FtpClientIntegrationTest.java rename to libraries-6/src/test/java/com/baeldung/ftp/FtpClientIntegrationTest.java diff --git a/libraries/src/test/java/com/baeldung/ftp/JdkFtpClientIntegrationTest.java b/libraries-6/src/test/java/com/baeldung/ftp/JdkFtpClientIntegrationTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/ftp/JdkFtpClientIntegrationTest.java rename to libraries-6/src/test/java/com/baeldung/ftp/JdkFtpClientIntegrationTest.java diff --git a/libraries/src/test/java/com/baeldung/javapoet/test/PersonGeneratorUnitTest.java b/libraries-6/src/test/java/com/baeldung/javapoet/test/PersonGeneratorUnitTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/javapoet/test/PersonGeneratorUnitTest.java rename to libraries-6/src/test/java/com/baeldung/javapoet/test/PersonGeneratorUnitTest.java diff --git a/libraries/src/test/java/com/baeldung/javapoet/test/person/Gender.java b/libraries-6/src/test/java/com/baeldung/javapoet/test/person/Gender.java similarity index 100% rename from libraries/src/test/java/com/baeldung/javapoet/test/person/Gender.java rename to libraries-6/src/test/java/com/baeldung/javapoet/test/person/Gender.java diff --git a/libraries/src/test/java/com/baeldung/javapoet/test/person/Person.java b/libraries-6/src/test/java/com/baeldung/javapoet/test/person/Person.java similarity index 100% rename from libraries/src/test/java/com/baeldung/javapoet/test/person/Person.java rename to libraries-6/src/test/java/com/baeldung/javapoet/test/person/Person.java diff --git a/libraries/src/test/java/com/baeldung/javapoet/test/person/Student.java b/libraries-6/src/test/java/com/baeldung/javapoet/test/person/Student.java similarity index 100% rename from libraries/src/test/java/com/baeldung/javapoet/test/person/Student.java rename to libraries-6/src/test/java/com/baeldung/javapoet/test/person/Student.java diff --git a/libraries/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java b/libraries-6/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java rename to libraries-6/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java diff --git a/libraries/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java b/libraries-6/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java similarity index 96% rename from libraries/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java rename to libraries-6/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java index 9a3ef0747b..b86094b6f4 100644 --- a/libraries/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java +++ b/libraries-6/src/test/java/com/baeldung/reflections/ReflectionsUnitTest.java @@ -1,50 +1,50 @@ -package com.baeldung.reflections; - -import static org.junit.jupiter.api.Assertions.assertFalse; - -import org.junit.jupiter.api.Test; - -public class ReflectionsUnitTest { - - @Test - public void givenTypeThenGetAllSubTypes() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getReflectionsSubTypes() - .isEmpty()); - } - - @Test - public void givenTypeAndUsingBuilderThenGetAllSubTypes() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getReflectionsSubTypesUsingBuilder() - .isEmpty()); - } - - @Test - public void givenAnnotationThenGetAllAnnotatedMethods() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getDateDeprecatedMethods() - .isEmpty()); - } - - @Test - public void givenAnnotationThenGetAllAnnotatedConstructors() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getDateDeprecatedConstructors() - .isEmpty()); - } - - @Test - public void givenParamTypeThenGetAllMethods() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getMethodsWithDateParam() - .isEmpty()); - } - - @Test - public void givenReturnTypeThenGetAllMethods() { - ReflectionsApp reflectionsApp = new ReflectionsApp(); - assertFalse(reflectionsApp.getMethodsWithVoidReturn() - .isEmpty()); - } -} +package com.baeldung.reflections; + +import static org.junit.jupiter.api.Assertions.assertFalse; + +import org.junit.jupiter.api.Test; + +public class ReflectionsUnitTest { + + @Test + public void givenTypeThenGetAllSubTypes() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getReflectionsSubTypes() + .isEmpty()); + } + + @Test + public void givenTypeAndUsingBuilderThenGetAllSubTypes() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getReflectionsSubTypesUsingBuilder() + .isEmpty()); + } + + @Test + public void givenAnnotationThenGetAllAnnotatedMethods() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getDateDeprecatedMethods() + .isEmpty()); + } + + @Test + public void givenAnnotationThenGetAllAnnotatedConstructors() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getDateDeprecatedConstructors() + .isEmpty()); + } + + @Test + public void givenParamTypeThenGetAllMethods() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getMethodsWithDateParam() + .isEmpty()); + } + + @Test + public void givenReturnTypeThenGetAllMethods() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getMethodsWithVoidReturn() + .isEmpty()); + } +} diff --git a/libraries/src/test/java/com/baeldung/resilience4j/Resilience4jUnitTest.java b/libraries-6/src/test/java/com/baeldung/resilence4j/Resilience4jUnitTest.java similarity index 99% rename from libraries/src/test/java/com/baeldung/resilience4j/Resilience4jUnitTest.java rename to libraries-6/src/test/java/com/baeldung/resilence4j/Resilience4jUnitTest.java index ced95c99cb..1d69d20bc2 100644 --- a/libraries/src/test/java/com/baeldung/resilience4j/Resilience4jUnitTest.java +++ b/libraries-6/src/test/java/com/baeldung/resilence4j/Resilience4jUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.resilience4j; +package com.baeldung.resilence4j; import io.github.resilience4j.bulkhead.Bulkhead; import io.github.resilience4j.bulkhead.BulkheadConfig; diff --git a/libraries/src/test/resources/ftp/baz.txt b/libraries-6/src/test/resources/ftp/baz.txt similarity index 100% rename from libraries/src/test/resources/ftp/baz.txt rename to libraries-6/src/test/resources/ftp/baz.txt diff --git a/libraries/pom.xml b/libraries/pom.xml index 5d540f0d90..da9c9de907 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -12,18 +12,18 @@ - - - com.typesafe.akka - akka-actor_2.12 - ${typesafe-akka.version} - - - com.typesafe.akka - akka-testkit_2.12 - ${typesafe-akka.version} - test - + + + + + + + + + + + + org.beykery @@ -36,16 +36,16 @@ cglib ${cglib.version} - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - commons-net - commons-net - ${commons-net.version} - + + + + + + + + + + org.javatuples @@ -64,11 +64,11 @@ ${javers.version} - - io.nats - jnats - ${jnats.version} - + + + + + @@ -228,11 +228,11 @@ jool ${jool.version} - - org.openjdk.jmh - jmh-core - ${jmh.version} - + + + + + junit junit @@ -244,18 +244,18 @@ java-lsh ${java-lsh.version} - - au.com.dius - pact-jvm-consumer-junit_2.11 - ${pact.version} - test - - - org.codehaus.groovy - groovy-all - - - + + + + + + + + + + + + @@ -274,16 +274,16 @@ ${org.hamcrest.java-hamcrest.version} test - - net.bytebuddy - byte-buddy - ${bytebuddy.version} - - - net.bytebuddy - byte-buddy-agent - ${bytebuddy.version} - + + + + + + + + + + @@ -320,43 +320,43 @@ - - com.codepoetics - protonpack - ${protonpack.version} - - - org.functionaljava - functionaljava-java8 - ${functionaljava.version} - - - com.github.ben-manes.caffeine - caffeine - ${caffeine.version} - + + + + + + + + + + + + + + + - - - com.github.docker-java - docker-java - ${docker.version} - - - org.slf4j - slf4j-log4j12 - - - org.slf4j - jcl-over-slf4j - - - ch.qos.logback - logback-classic - - - - + + + + + + + + + + + + + + + + + + + + + @@ -364,58 +364,58 @@ google-oauth-client-jetty ${google-api.version} - - org.apache.kafka - kafka-streams - ${kafka.version} - - - org.apache.kafka - kafka-clients - ${kafka.version} - test - test - + + + + + + + + + + + + - - - io.atlassian.fugue - fugue - ${fugue.version} - + + + + + + - - org.jctools - jctools-core - ${jctools.version} - + + + + + - - io.github.resilience4j - resilience4j-circuitbreaker - ${resilience4j.version} - - - io.github.resilience4j - resilience4j-bulkhead - ${resilience4j.version} - - - io.github.resilience4j - resilience4j-retry - ${resilience4j.version} - - - io.github.resilience4j - resilience4j-timelimiter - ${resilience4j.version} - - - com.squareup - javapoet - ${javapoet.version} - + + + + + + + + + + + + + + + + + + + + + + + + + org.hamcrest hamcrest-all @@ -423,18 +423,18 @@ test - - org.mockftpserver - MockFtpServer - ${mockftpserver.version} - test - - - - org.reflections - reflections - ${reflections.version} - + + + + + + + + + + + + @@ -562,7 +562,7 @@ 1.2 3.6.2 3.1.0 - 1.0 + 2.92 1.9.26 @@ -574,24 +574,24 @@ 3.5.0 2.0.0.0 - 1.7.1 + - 1.15 - 2.5.5 + + 1.23.0 - 2.0.0 - 3.0.14 + + 0.9.4.0006L - 2.1.2 - 2.5.11 - 0.12.1 - 1.10.0 + + + + 1.3 3.2.0-m7 5.1.1 @@ -603,17 +603,17 @@ 3.0.3 2.3.0 0.9.12 - 1.19 + - 4.8.1 - 4.5.1 + + 3.0.2 - 2.7.1 - 3.6 - 0.9.11 + + +