JDriven Blog

Kotlin Discovered: Data Class

Posted on by  
Jacob van Lingen

You never touched Groovy, nor did you jump on the Scala train. Clojure never attracted you; and you heard about Ceylon long after the language had already died. You are one of those old-fashioned Java folks! But now, after all those years, you want to join the cool Kotlin kids. So, where to start? Let’s discover the language together by decompiling it to Java code. Today: the Data class!

Continue reading →

Kotlin Discovered: Standard Class

Posted on by  
Jacob van Lingen

You never touched Groovy, nor did you jump on the Scala train. Clojure never attracted you; and you heard about Ceylon long after the language had already died. You are one of those old-fashioned Java folks! But now, after all those years, you want to join the cool Kotlin kids. So, where to start? Let’s discover the language together by decompiling it to Java code. Today: the Kotlin Class!

Continue reading →

Kotlin Discovered: Functions

Posted on by  
Jacob van Lingen

You never touched Groovy, nor did you jump on the Scala train. Clojure never attracted you; and you heard about Ceylon long after the language had already died. You are one of those old-fashioned Java folks! But now, after all those years, you want to join the cool Kotlin kids. So, where to start? Let’s discover the language together by decompiling it to Java code. Today: Functions!

Continue reading →

Error handling

Posted on by  
Ties van de Ven

A lot of applications seem to either only use runtime exceptions or only use error monads like the Optional for error handling. In this blog I will try to dive a bit deeper into when to use one over the other (tldr: you probably need both)

Continue reading →

Java Joy: Using mapMulti Method Of The Stream API

Posted on by  
Hubert Klein Ikkink

Since Java 16 we can use the method mapMulti(BiConsumer) of the Stream API. This method allows us to map each element of the stream to multiple elements. We can also do that with the flatMap(Function) method, but if we want to map a limited set of elements, mapMulti is more convenient. Internally a shared stream is used and we don’t have the cost of creating a new stream for each element. Another use case is if the logic to map an element to multiple elements is complex and is hard to implement by returning a stream. Then mapMulti allows us to write that logic in a BiConsumer instead of a Function.

Continue reading →

Awesome AssertJ: Writing Assertions For Optional

Posted on by  
Hubert Klein Ikkink

For a lot of types AssertJ has special assertion methods. Also for the type Optional. If we want to assert an Optional value we can use several methods that AssertJ provides. For example to check if an Optional is present we can use isPresent() or the alias isNotEmpty(). To check if the Optional is empty we can use isEmpty() or the alias isNotPresent(). Checking the value of an Optional (if it is indeed set) can be done with hasValue() or contains(). For more fine grained assertions on the value we can use hasValueSatisfying(Condition) or hasValueSatisfying(Consumer). With the map(Function) and flatMap(Function) methods we can map the Optional, if not empty, to another value and assert that value.

Continue reading →

Awesome AssertJ: Assertions For An URL Object

Posted on by  
Hubert Klein Ikkink

AssertJ has a lot of custom assertion methods for different types. For example to assert an URL object AssertJ gives us some specific methods. We can check for different components of the URL instance with different methods. For example we can check if the protocol is equal to the protocol we expect with hasProtocol(String). Similarly we can write assertions for the host, port, authority, path and anchor. To assert query parameters we can use hasQueryParameter(String) to check if query parameter is set and with hasQueryParameter(String, String) we can check if the query parameter has an expected value. To check the whole query string we can use hasQueryString(String).

Each of the assertion methods also has version to assert a component is not present. For example hasNoQuery() to assert a query is not defined for an URL.

Continue reading →

Using Diffblue Cover to Write Tests for Existing Code

Posted on by  
Quinton Weenink

In a previous blog post we looked into how to get started with Diffblue Cover. In this post, we will focus on utilizing Diffblue Cover to generate tests for a pre-existing project that contains untested code.

I find the best time to write tests to be as you write the code but, sometimes we discover untested code in our projects. Fully understanding someone else’s code that does not have tests written for it can be difficult and quite time-consuming. Let’s try out Diffblue Cover to see if it can help us.

Continue reading →

Team Topologies: Building High-Performance Software Teams through culture

Posted on by  
Erik Pronk

Michael Jordan once said, "Talent wins games, but teamwork and intelligence win championships."

This quote perfectly illustrates the importance of team culture in building high-performance software development teams that can work together effectively to achieve a common goal. In software engineering, this means understanding the concept of team topologies and how they can shape and support team culture.

Continue reading →

Getting Started with Diffblue Cover

Posted on by  
Quinton Weenink

Diffblue Cover is an AI-powered software testing tool that generates unit tests for Java code. Tests can easily be generated directly from your code using the Diffblue Cover IntelliJ plugin. Let’s get started by setting up Diffblue Cover and start generating tests.

Continue reading →

shadow-left