Showing posts from June, 2014

HOW-TO: Surround text with quote in IntelliJ

A quick tip on how to surround a selection with quote or brace in IntelliJ.

Better error messages with Bean Validation 1.1 in Spring MVC application

Bean Validation 1.1 , among many new features, introduced error message interpolation using Unified Expression Language (EL) expressions. This allows to define error messages based on conditional logic and also enables advanced formatting options . Added to a Spring MVC application let you display more friendly error messages quite simply. In the first part of this article I will shortly describe message interpolation with EL expressions, in the second part we will build a simple web application with Spring Boot and Thymeleaf that runs on Tomcat 8.

Lambda Expressions and Stream API: basic examples

This blog post contains a list of basic Lambda expressions and Stream API examples I used in a live coding presentation I gave in June 2014 at Java User Group - Politechnica Gedanensis (Technical University of Gdańsk) and at Goyello .

Test Data Builders and Object Mother: another look

Constructing objects in tests is usually a painstaking work and usually it produces a lot of repeatable and hard to read code. There are two common solutions for working with complex test data: Object Mother and Test Data Builder . Both has advantages and disadvantages, but (smartly) combined can bring new quality to your tests.

Some interesting links I encountered recently

A selection of the links I encountered recently. A very subjective selection.

Listing a ZIP file contents with Stream API in Java 8

In Java 8 was equipped with a stream method that allows navigating over a ZIP file entries very easily. In this blog post I will show a bunch of examples showing how quickly we can navigate over ZIP file entries.

Spring 4: @DateTimeFormat with Java 8 Date-Time API

@DateTimeFormat annotation that was introduced in Spring 3.0 as a part of Formatter SPI can be used to to parse and print localized field values in web applications. In Spring 4.0, @DateTimeFormat annotation can be used with Java 8 Date-Time API ( java.time ) out-of-the-box, without extra effort.