From Arrays to Streams and Back with Java 8

On November 16, 2015, Posted by , In Common,Spotlight, By ,,,, , With 4 Comments

Not long ago we upgraded some Eclipse plug-in projects to Java 8. And never looked back since. Among many other things, filtering, mapping, and finding elements in collections has become so much easier and more concise with lambdas and the streams API. Nothing new so far for the most of…

Gonsole Requirement Upgrade to JRE 8

On October 8, 2015, Posted by , In Gonsole, By ,,, , With Comments Off on Gonsole Requirement Upgrade to JRE 8

Just a short notice for all users of gonsole. There has been a gonsole requirement upgrade since Rüdiger and I decided to move to Java 8 wherever possible. This means support of Eclipse IDE versions prior Luna (4.4) has been discontinued. This also affects the features of the Xiliary repository….

Getting Java Event Notification Right

On March 11, 2015, Posted by , In Common,Spotlight, By ,, , With 6 Comments

Implementing the observer pattern to provide Java event notification seems to be a straight forward thing to do. However, there are some pitfalls one easily can run into. Here comes an explanation of common mistakes I carelessly have produced myself on various occasions… Java Event Notification Let’s start with a…

How to Map Distinct Value Types Using Java Generics

On March 4, 2015, Posted by , In Common,Spotlight, By ,, , With 6 Comments

Occasionally the average developer runs into a situation where he has to map values of arbitrary types within a particular container. However, the Java collection API provides container related parameterization only. Which limits the type safe usage of HashMap for example to a single value type. But what if you…

Clean JUnit Throwable-Tests with Java 8 Lambdas

On July 28, 2014, Posted by , In JUnit, By ,,,, , With 7 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….

Java Code Style: The Final Decision

On April 28, 2014, Posted by , In Common, By ,,,, , With 6 Comments

Isn’t it funny how the alleged most unremarkable things can lead to controversial discussions or sometimes even heated debates with hardened fronts? I witnessed on several occasions, for example, how the usage of the Java final keyword triggered quite passionate arguments. And for an outside observer this might have looked…

Clean Synchronization Using ReentrantLock and Lambdas

Recently I was reading an informative post about the differences between synchronized vs ReentrantLock by Javin Paul1. He emphasises on the advantages of the latter, but does not withhold some downsides, which are related to the cumbersome try-finally block needed for proper usage. While agreeing with his statements I brooded…

Slim Down SWT FormLayout Usage

On March 31, 2014, Posted by , In Eclipse, By ,,,, , With 2 Comments

Always on the quest for efficiency I reconsidered the usability of SWT FormLayout lately. Although it is one of my favored core layouts with respect to flexibility, I had to recognize that it is only reluctantly used by most of my fellow workers. Proposing it for an appropriate task sometimes…

What are Mockito Extra Interfaces?

On March 24, 2014, Posted by , In JUnit, By ,,,,, , With 7 Comments

Mockito is my favored little helper if it comes down to write light weight JUnit tests. It is very useful to replace the ‘real’ dependencies of a unit under test easily by mocks if necessary. In particular when working on the borderline to framework APIs such dependencies can otherwise be…

Getting JUnit Test Names Right

Finding good names is one of the challenges of crafting software. And you need to find them all the time and for everything – classes, methods, variables, just to name a few. But what makes a name a good name? To quote Uncle Bob: ‘Three things: Readability, readability, and readability!’…

Clean SWT Listener Notifcations with SWTEventHelper

On March 10, 2014, Posted by , In Eclipse, By ,,,,,, , With 2 Comments

Writing tests for SWT based UIs often requires to notify widget listeners programmatically. Unfortunately, the code to create, initialize and finally to trigger the event is a bit verbose and distracts from the actual purpose of the test. After writing similar initialization routines a couple of times I came up…

SWT: Do You Know the Difference between Tree#select and Tree#setSelection?

On March 5, 2014, Posted by , In Eclipse, By ,,,,,, , With 3 Comments

Actually I did not, neither did Google and the API documentation seems to miss out one crucial point – which took me some time to figure out. So I decided to be a nice boy scout and share my findings as my good deed of the day 1. According to…

A JUnit Rule to Ease SWT Test Setup

On February 25, 2014, Posted by , In Eclipse,JUnit, By ,,,,, , With Comments Off on A JUnit Rule to Ease SWT Test Setup

Rüdiger and I have written a lot of SWT test cases for our current RCP project lately. Most of the time we can execute them as plain JUnit tests. Still they also have to run in a RCP integration environment. Long story short we wrote a DisplayHelper fixture to reduce…

Responsive UIs with Eclipse and SWT

On February 24, 2014, Posted by , In Eclipse, By ,,,,,, , With 1 Comment

Recently I had the problem that my ‘well-conceived’ view design did not scale down reasonably. I realized that the flexibility to arrange viewparts in stacks of arbitrary sizes in an Eclipse workbench window does not exactly ease the development of appealing UIs. At least if you strive for more than…

Mockito Templates for Eclipse

On February 10, 2014, Posted by , In Eclipse,JUnit, By ,,,, , With Comments Off on Mockito Templates for Eclipse

Sometimes I miss the forest for the trees – and that for a disturbingly long time. I just became aware of this once again recently, typing one of the more verbose mockito expressions for the umpteenth time. The statement in question was a doAnswer(Answer) construct which always feels a bit…

Running JUnit Tests Repeatedly Without Loops

On April 10, 2013, Posted by , In JUnit, By ,,, , With 26 Comments

Recently I came across a problem where I had to write tests for a method that calculates randomly distributed values within a certain range of possibilities 1. More precisely if you assume a signature that looks like interface RandomRangeValueCalculator { long calculateRangeValue( long center, long radius ); } a test…

Working Efficiently with JUnit in Eclipse

On November 26, 2012, Posted by , In Eclipse,JUnit, By ,,,, , With 11 Comments

Recently I was dragged into a discussion1 with some test infected2 fellows about how we use JUnit within the Eclipse IDE. Surprisingly the conversation brought up some ‘tips and tricks’ not everybody was aware of. This gave me the idea to write this post doing a sum up of our…

JUnit Rules

On September 24, 2012, Posted by , In JUnit, By ,,, , With 20 Comments

The first time I stumbled over a JUnit @Rule annotation I was a bit irritated of the concept. Having a public field in a test case seemed somewhat odd and so I was reluctant to use it regularly. But after a while I got used to that and it turned…

Running HTTP/REST Integration Tests efficiently in Eclipse

On September 10, 2012, Posted by , In Eclipse,JUnit, By ,,,,, , With 8 Comments

Lately I had a chance to use the OSGi-JAX-RS-Connector library written by my dear fellow Holger Staudacher. The connector enables you to publish resources easily by registering @Path annotated types as OSGi services – which actually works quite nicely. While it is natural for me to write the service classes…

Performance Analysis of REST/HTTP Services with JMeter and Yourkit

On February 10, 2012, Posted by , In Common, By ,,,,,, , With 11 Comments

My last post described how to accomplish stress- or load-testing of asynchronous REST/HTTP services with JMeter. However, running such tests often reveals that the system under test does not deal well with increasing load. The question is now how to find the bottleneck? Having an in-depth look at the code…