Generating JUnit Tests with Java, EvoSuite and Maven

Generating test suites for existing code allows us to verify the behaviour of an application before we’re making changes to its code base or for regression testing. In the following short tutorial I’d like to demonstrate how to derive test suites from an existing Java application using EvoSuite and the EvoSuite Maven plug-in. EvoSuite offers some nice features like running in a sandbox to avoid dangerous operations, virtual file-system and network and optimizing of different coverage criteria. ...

February 28, 2016 · 5 min · 962 words · Micha Kops

Generating Java Source Files with JavaPoet

For the most of us developers, generating Java source files is an occasionally happening task and we’re dealing with it e.g. when writing annotation processors, writing tools or interacting with meta-data files. JavaPoet is a nice library to simplify such tasks, offering an intuitive fluent-builder API to generate source files in no time. In the following tutorial I’d like to share a few examples by writing code generators with the help of this library. ...

February 28, 2015 · 5 min · 1035 words · Micha Kops

Using jOOQ and Build Helper Plugin to Generate Database Metamodels with Maven

When you need to derive meta-models from existing databases and want to create type-safe queries with an elegant, fluent-API, jOOQ definitely is a tool to consider here. In the following tutorial I’d like to demonstrate how to integrate the jOOQ meta-model generator into a Maven build using the jOOQ Maven Plug-in, the Build Helper Maven Plug-in and Maven profiles to finally create a running application to query an existing RDBMS using such a generated meta-model. ...

June 10, 2014 · 7 min · 1363 words · Micha Kops

Playing around with QR Codes

Sometimes QR codes are a nice way to distribute information like calendar events, contact information, e-mail, geo-locations or internet addresses. In the following article we’re going to encode information to QR code images using the ZXing library and afterwards decode information from a given QR code. Finally we’re taking a look on online QR code generators and how to integrate the ZXing library in a Maven project. The ZXing Library Download the ZXing Libraries from http://code.google.com/p/zxing/downloads/list – the file name is ZXing-<version>.zip Unpack the downloaded archive somewhere Change to the extracted directory and run ant. If you don’t have JavaME installed – and you don’t have to for the samples below – run ant buildwithoutj2me – that will do the job Having compiled the libraries you’re now free to include the core.jar from zxing-<version>/core/ and the javase.jar from zxing-<version>/javase as dependency in your project ...

May 11, 2010 · 5 min · 1041 words · Micha Kops