Blog

How to Access a Git Repository with JGit

On September 22, 2014, Posted by , In Eclipse, By ,,, , With No Comments

A Git repository is represented in JGit through the Repository class that can be viewed as a handle to a repository. With a Repository instance, you can create JGit commands (through the Git factory class), gain access to configuration settings, resolve refs, etc. There are several ways to obtain a…

How to Safely Use SWT’s Display asyncExec

On September 15, 2014, Posted by , In Eclipse, By ,, , With No Comments

Most user interface (UI) toolkits are single-threaded and SWT is no exception. This means that UI objects must be accessed exclusively from a single thread, the so-called UI thread. On the other hand, long running tasks should be executed in background threads in order to keep the UI responsive. This…

JUnit in a Nutshell: Unit Test Assertion

On September 10, 2014, Posted by , In JUnit, By ,,, , With 2 Comments

This chapter of JUnit in a Nutshell covers various unit test assertion techniques. It elaborates on the pros and cons of the built-in mechanism, Hamcrest matchers and AssertJ assertions. The ongoing example enlarges upon the subject and shows how to create and use custom matchers/assertions. Unit Test Assertion The post…

JUnit in a Nutshell: Test Runners

On September 3, 2014, Posted by , In JUnit, By ,,, , With 1 Comment

The fourth chapter of my multi-part tutorial about JUnit testing essentials explains the purpose of the tool’s exchangable test runners architecture and introduces some of the available implementations. The ongoing example enlarges upon the subject by going through the different possibilities of writting parameterized tests. Since I have already published…

Travis: Continuous Integration for GitHub Projects

On September 1, 2014, Posted by , In Common, By ,, , With No Comments

In a recent project I got the opportunity to work with Travis, a lean, hosted continuous integration service used to build GitHub projects that is free to use for public repositiories. This post gives a brief introduction on how to build projects with Travis. Simple Setup Setting up Travis to…

JUnit in a Nutshell: Test Isolation

On August 27, 2014, Posted by , In JUnit, By ,,, , With 1 Comment

Working as a consultant I still meet quite often programmers, who have at most a vague understanding of JUnit and its proper usage. This gave me the idea to write a multi-part tutorial to explain the essentials from my point of view. Despite the existence of some good books and…

JUnit in a Nutshell: Test Structure

On August 18, 2014, Posted by , In JUnit, By ,,, , With 1 Comment

Despite the existence of books and articles about JUnit testing, I still meet quite often programmers, who at most have a vague understanding of the tool and its proper usage. Hence I had the idea to write a multi-part tutorial, that explains the essentials from my point of view. Maybe…

JUnit in a Nutshell: Hello World

On August 12, 2014, Posted by , In JUnit, By ,,, , With 5 Comments

JUnit seems to be the most popular testing tool for developers within the Java world. So it is no wonder that there have been written some good books about this topic. But by earning a living as consultant I still meet quite often programmers, who at most have a vague…

Clean JUnit Throwable-Tests with Java 8 Lambdas

On July 28, 2014, Posted by , In JUnit, By ,,,, , With 2 Comments

Recently I was involved in a short online discussion on twitter and google+ which concerned the question why the arrival of Java 8 Lambda expressions makes the catch-exception library1 obsolete. This was triggered by a brief announcement that the library won’t be longer maintained as lambdas will make it redundant….

A JUnit Rule to Run a Test in Its Own Thread

On July 21, 2014, Posted by , In JUnit, By ,,, , With No Comments

In JUnit it could be occasionally helpful to run a test in its own thread. In particular when writing integration tests that interact with encapsulated ThreadLocals or the like this could come in handy. A separate thread would implicitly ensure that the thread related reference of the threadlocal is uninitialized…