Introduction to Mockito’s AdditionalAnswers
1. Overview In this tutorial, we'll get familiar with Mockito's AdditionalAnswers class and its methods. 2. Returning Arguments The main purpose of the AdditionalAnswers class is to return parameters...
View ArticleConvert String to Integer in Groovy
1. Overview In this short tutorial, we'll show different ways to convert from String to Integer in Groovy. 2. Casting with as The first method that we can use for the conversion is the as keyword,...
View ArticleHow to Get String From Mono in Reactive Java
1. Overview In our Intro to Project Reactor, we learned about Mono<T>, which is a publisher of an instance of type T. In this quick tutorial, we'll show both a blocking and a non-blocking way to...
View ArticleWriting Templates for Test Cases Using JUnit 5
1. Overview The JUnit 5 library offers many new features over its previous versions. One such feature is test templates. In short, test templates are a powerful generalization of JUnit 5's...
View ArticleHTTP/2 in Jetty
1. Overview The HTTP/2 protocol comes with a push feature that allows the server to send multiple resources to the client for a single request. Hence, it improves the loading time of the page by...
View ArticleIntroduction to DBUnit
1. Introduction In this tutorial, we'll take a look at DBUnit, a unit testing tool used to test relational database interactions in Java. We'll see how it helps us get our database to a known state and...
View ArticleHow to Test GraphQL Using Postman
1. Overview In this short tutorial, we'll show how to test GraphQL endpoints using Postman. 2. Schema Overview and Methods We'll use the endpoints created in our GraphQL tutorial. As a reminder, the...
View ArticleHandling java.net.ConnectException
1. Introduction In this quick tutorial, we'll discuss some possible causes of java.net.ConnectException. Then, we'll show how to check the connection with the help of two publicly available commands...
View ArticleThe Map.computeIfAbsent() Method
1. Overview In this tutorial, we'll look briefly at the new default method computeIfAbsent of the Map interface introduced in Java 8. Specifically, we will look at its signature, usage and how it...
View ArticleShould We Close a Java Stream?
1. Overview With the introduction of lambda expressions in Java 8, it's possible to write code in a more concise and functional way. Streams and Functional Interfaces are the heart of this...
View ArticleRecommended Package Structure of a Spring Boot Project
1. Overview When building a new Spring Boot project, there's a high degree of flexibility on how we can organize our classes. Still, there are some recommendations that we need to keep in mind. 2....
View ArticleHibernate Error “No Persistence Provider for EntityManager”
1. Introduction In this tutorial, we'll see how to solve a common Hibernate error — “No persistence provider for EntityManager”. Simply put, persistence provider refers to the specific JPA...
View ArticleA Guide to Atomikos
1. Introduction Atomikos is a transaction library for Java applications. In this tutorial, we'll understand why and how to use Atomikos. In the process, we'll also go through the basics of transactions...
View ArticleOracle Connection Pooling With Spring
1. Overview Oracle is one of the most popular databases in large production environments. So, as Spring developers, it's very common to have to work with these databases. In this tutorial, we're going...
View ArticleLog Groups in Spring Boot 2.1
1. Overview Spring Boot provides many auto-configurations to facilitate writing enterprise applications. However, it was always a bit cumbersome to apply the same logging configuration to a set of...
View ArticleJava Weekly, Issue 330
1. Spring and Java >> Spring Tips: The GraalVM Native Image Builder Feature [spring.io] A quick intro to GraalVM support for building blazingly fast native images from Spring Boot apps. Very...
View ArticleUsing ThymeLeaf and FreeMarker Emails Templates with Spring
1. Overview In our previous article, we saw how to use Spring to write and send text emails. But it's also possible to use Spring template engines to write beautiful HTML emails with dynamic content....
View ArticleUsing a List of Values in a JdbcTemplate IN Clause
1. Introduction In a SQL statement, we can use the IN operator to test whether an expression matches any value in a list. Therefore, we can use the IN operator instead of multiple OR conditions. In...
View ArticleA Guide to jpackage in Java 14
1. Overview In this tutorial, we'll explore the new packaging tool introduced in Java 14, named jpackage. 2. Introduction jpackage is a command-line tool to create native installers and packages for...
View ArticleHow to Determine the Data Type in Groovy
1. Introduction In this quick tutorial, we're going to explore different ways to find the data type in Groovy. Actually, it's different depending on what we're doing: First, we'll look at what to do...
View Article