Home » Java

Java

JDK 16: Checking Indexes and Ranges of Longs

In my last post, I described the day period support added with JDK 16 Early Access Build 25. That same build also added methods for checking indexes and ranges of long values, which is the subject of this post. JDK-8255150 (“Add utility methods to check long indexes and ranges”) is the Enhancement used to add utility methods for checking long ...

Read More »

Static Factories are Great!

Every now and then I jump on classes with multiple constructors or classes that are rigorous to work with. Let alone not being able to mock part of their components and at the end being forced to use reflection for testing (mockito based, old school, you choose). Imagine a Producer class that you use for Kafka. A class that provides ...

Read More »

Spring Web MVC

spring-interview-questions-answers

Spring MVC is a web framework based on the model–view–controller pattern. It is based on the Spring principles and supports a wide range of server-side rendering technologies as JSP, Thymeleaf, Groovy, among others. Dispatcher Servlet It is a front controller that coordinates all the request handling activities. Delegates to the web infrastructure beans and invokes the user’s web components. It ...

Read More »

Day Period Support in JDK 16

JDK 16 Early Access Build 25 (2020/11/18) includes changes for JDK-8247781 (“Day periods support”). As stated in the JDK 16 Early Access Build 25 Release Notes (“Day period support added to java.time formats”), the new functionality “translates day periods defined in Unicode Consortium‘s CLDR.” In most English-language situations using a “12-hour clock“, the “day periods” might be used instead of ...

Read More »

Testing Expected Exceptions with JUnit 5

This post shows how to test for expected exceptions using JUnit 5. If you’re still on JUnit 4, please check out my previous post. Let’s start with the following class that we wish to test: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 public class Person {   private final ...

Read More »

Constrast DataWeave and Java mapping operations

Main points: DataWeave 2.0 provides mapping capabilitiesJava and DataWeave can achieve the same mappingsDataWeave mapping operator is less verbose than Java DataWeave map operator The DataWeave 2.0 (Mule 4) map operator shares similarities with the map() method from Java’s Stream class. Mapping is a transformative operation The idea of mapping is to transform each element of an array and output ...

Read More »