Programming

Spring From the Trenches: Using Null Values in DbUnit Datasets

If we are writing integration tests for an application that uses Spring Framework, we can integrate DbUnit with the Spring testing framework by using Spring Test DbUnit. However, this integration is not problem free. Often we have to insert null values to the database before our tests are run or verify that the value saved […] Read more

Using Asciidoctor with Spring: Rendering Asciidoc Documents with Spring MVC

Asciidoc is a text based document format, and that is why it is very useful if we want to commit our documents into a version control system and track the changes between different versions. This makes Asciidoc a perfect tool for writing books, technical documents, FAQs, or user’s manuals. After we have created an Asciidoc […] Read more

Getting Started With Gradle: Creating a Binary Distribution

After we have created a useful application, the odds are that we want to share it with other people. One way to do this is to create a binary distribution that can be downloaded from our website. This blog post describes how we can build a binary distribution that fulfils the following requirements: Our binary […] Read more

Writing Tests for Data Access Code - Data Matters

When we write tests for our data access code, we use datasets for two different purposes: We initialize our database into a known state before our data access tests are run. We verify that the correct changes are found from the database. These seem like easy tasks. However, it is very easy to mess things […] Read more

Writing Clean Tests - To Verify Or Not To Verify

When we write unit tests that use mock objects, we follow these steps: Configure the behavior of our mock objects. Invoke the tested method. Verify that the correct methods of our mock objects were invoked. The description of the third step is actually a bit misleading, because often we end up verifying that the correct […] Read more

Writing Tests for Data Access Code - Don't Forget the Database

When we write tests for our data access code, we must follow these three rules: Our tests must use the real database schema. Our tests must be deterministic. Our tests must assert the right thing. These rules are obvious. That is why it is surprising that some developers break them (I have broken them too […] Read more