<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>pieterjd.be</title><link>https://pieterjd.github.io/</link><description>Recent content on pieterjd.be</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Tue, 21 May 2024 23:42:38 +0200</lastBuildDate><atom:link href="https://pieterjd.github.io/index.xml" rel="self" type="application/rss+xml"/><item><title>Speedup Writing Tests with Wiremock Spring Boot Voxxed Days Brussels 2024</title><link>https://pieterjd.github.io/talks/speedup-writing-tests-with-wiremock-spring-boot-voxxeddays-brussels-2024/</link><pubDate>Tue, 21 May 2024 23:42:38 +0200</pubDate><guid>https://pieterjd.github.io/talks/speedup-writing-tests-with-wiremock-spring-boot-voxxeddays-brussels-2024/</guid><description>Calling APIs is business as usual. Building API clients is always good fun, testing them is somewhat trickier.
Wiremock is one of the most frequently used tools to mock APIs. Setting it up for testing purposes in your Spring Boot application is a bit daunting. Or should I say: WAS daunting. Enter WireMock Spring Boot, making your life easier.
In this short talk I&amp;rsquo;ll introduce the idead behind Wiremock. Next, we&amp;rsquo;ll put this newly gained knowledge into practice and craft unittests for a JsonPlaceholder client.</description></item><item><title>Regular Expressions with JQ</title><link>https://pieterjd.github.io/posts/jq-regex/</link><pubDate>Wed, 21 Feb 2024 07:29:12 +0000</pubDate><guid>https://pieterjd.github.io/posts/jq-regex/</guid><description>I needed to go through the properties of a JSON object and filter out the desired ones. Although not a big object, I didn&amp;rsquo;t feel like doing it by hand. A nice use-case for JQ!</description></item><item><title>Add caching to Java's HttpClient</title><link>https://pieterjd.github.io/posts/decorator-httpclient/</link><pubDate>Mon, 19 Feb 2024 12:34:00 +0000</pubDate><guid>https://pieterjd.github.io/posts/decorator-httpclient/</guid><description>The out of the box HttpClient available since Java 11 is great, but is lacking caching. How to add this in a clean way? Welcom to the Decorator Design Pattern!</description></item><item><title>This Algorithm is 1,606,240% FASTER!</title><link>https://pieterjd.github.io/posts/this-algorithm-is-1606240-percent-faster/</link><pubDate>Sat, 25 Nov 2023 07:10:23 +0200</pubDate><guid>https://pieterjd.github.io/posts/this-algorithm-is-1606240-percent-faster/</guid><description>It is all in the title, but in this post I&amp;rsquo;ll go deeper how to represent encountered characters using bits.</description></item><item><title>Wiremock in 2 minutes</title><link>https://pieterjd.github.io/posts/wiremock-in-2-minutes/</link><pubDate>Wed, 04 Oct 2023 07:10:23 +0200</pubDate><guid>https://pieterjd.github.io/posts/wiremock-in-2-minutes/</guid><description>Wiremock helps you mock APIs, but how to get started? Two examples, two minutes of your time.</description></item><item><title>Sentry Sprint Boot Global Handler</title><link>https://pieterjd.github.io/posts/sentry-sprint-boot-global-handler/</link><pubDate>Fri, 30 Jun 2023 14:03:05 +0200</pubDate><guid>https://pieterjd.github.io/posts/sentry-sprint-boot-global-handler/</guid><description>Adding &lt;code>sentry.io&lt;/code> is quite straightforward, but how do you add a global handler?</description></item><item><title>Fallback Mechanism With Streams</title><link>https://pieterjd.github.io/posts/fallback-mechanism-with-streams/</link><pubDate>Wed, 28 Jun 2023 16:45:31 +0200</pubDate><guid>https://pieterjd.github.io/posts/fallback-mechanism-with-streams/</guid><description>The Problem I would like to summarize Person objects. Use the lastName if it is not null; if null, then use the firstName; else use the birthDay. If all these are null , then use the default text UNKNOWN.
Usually, you write something like this:
String summary = &amp;#34;&amp;#34;; if(p.getLastName() != null){ summary = p.getLastName(); } else if(p.getFirstName() != null){ summary = p.getFirstName(); } else if (p.getBirthDate() != null){ summary = p.</description></item><item><title>Advanced Grouping with Java streams</title><link>https://pieterjd.github.io/posts/java-stream-advanced-grouping/</link><pubDate>Mon, 22 May 2023 17:02:49 +0200</pubDate><guid>https://pieterjd.github.io/posts/java-stream-advanced-grouping/</guid><description>The problem I have a list of Person objects. I would like to group them per birth month, and only keep a List of lastnames.
I came up with this code from memory
Map&amp;lt;String, List&amp;lt;Person&amp;gt;&amp;gt; personsByMonth = persons.stream() .collect(Collectors.groupingBy(Person::getBirthMonth)); System.out.println(personsByMonth); And you get the following output (truncated for readability):
{JUNE=[Person{lastName='Doe 11', birthDate=2022-06-07}], JANUARY=[Person{lastName='Doe 10', birthDate=2023-01-26}]} But how do I get rid of the redundant information?
The solution The Collectors class provides quite a lot of variation of the groupingBy method.</description></item><item><title>Format and Highlight XML in the terminal</title><link>https://pieterjd.github.io/posts/cli-xml-formatting-highlighting/</link><pubDate>Mon, 08 May 2023 17:06:43 +0200</pubDate><guid>https://pieterjd.github.io/posts/cli-xml-formatting-highlighting/</guid><description>When working on legacy projects, you come across XML. And you would like some querying, highlighting and formatting to make your life less annoying.</description></item><item><title>Comparator and Null</title><link>https://pieterjd.github.io/posts/comparator-and-null/</link><pubDate>Wed, 03 May 2023 18:27:23 +0200</pubDate><guid>https://pieterjd.github.io/posts/comparator-and-null/</guid><description>Sorting collections has been quite easy with the &lt;code>Comparator&lt;/code> class. But how do you deal with possible &lt;code>null&lt;/code> values in for instance a &lt;code>List&lt;/code>? You probably see already the &lt;code>NullPointerException&lt;/code>s fly around, but fear not!</description></item></channel></rss>