Articles, Home

Next Steps to Pattern Matching in Java with Java 12 and Switch Expressions aka JEP 325

It is interesting to see how the Java language evolves over time. One thing that I have always missed is pattern matching in a way similar to languages like Scala.Now there are different JDK Enhancement Proposals (JEP) aiming at bringing us a little bit closer to pattern matching, especially JEP 325 aka Switch Expressions that are included in the current Java 12 preview or JEP 305 aka Pattern Matching for instanceof.In the following article, I’d like to demonstrate how to use switch expr

Articles, Home

Multiple null checks in Java 8

I have the below code which is bit ugly for multiple null checks.String s = null;if (str1 != null) { s = str1;} else if (str2 != null) { s = str2;} else if (str3 != null) { s = st…

Articles, Home

Using Throwaway Containers for Integration Testing with Java, JUnit 5 and Testcontainers

A lot of boilerplate code is written when developers need to test their applications with different connected systems like databases, stream platforms and other collaborators.Docker allows to handle those dependencies but there is still some glue code required to bind the container’s lifecycle and the configuration to the concrete integration test.Testcontainers is a testing library that offers lightweight throwaway instances of anything able to run in a Docker container, with bindings t