Transilvania JUG

Sponsors

09
Oct
2012
0

Helper for testing multi-threaded programs in Java

Testing multi-threaded code is hard. The main problem is that you invoke your assertions either too soon (and they fail for no good reason) or too late (in which case the test runs for a long time, frustrating you). A … Continue reading

03
Mar
2012
2

Deserializing arbitrary messages with Google Protcol Buffers

Google Protocol Buffers (shortened protobuf) is data (de)serialization with good speed, size and cross-platform support (it supports Java, C++ and Python out of the box). It can also handle different versions of the same message (as in: old and new … Continue reading

04
Jan
2012
0

Debugging the JVM

In some (rare) cases you might find yourself in the situation that you managed to crash the JVM itself. I most recently managed this by setting the name of a ThreadGroup to null. In these cases it is useful to … Continue reading

12
May
2011
0

Adding tab completition to Maven3 under Ubuntu

Maven 3 was released recently (depending on your definition of recent), but is not yet packaged for Ubuntu. This is generally not a problem, since the installation instructions are easy to follow (alternatively here are the installation instructions from the … Continue reading

20
Mar
2011
0

Navigating (Searching) Collections

The Java collections framework includes the concept of NavigableSets / NavigableMaps. The principle behind these interfaces is that taking a SortedSet/SortedMap you can use a subset of it. Some examples: Given the following set: 1 2 3 4 5 @Before … Continue reading

20
Mar
2011
0

Testing randomly

Some times it is useful to throw “random” data at your algorithm to see if it produces the correct result (see fuzz testing). This is especially true if you are writing some fundamental piece of code like a sort algorithm, … Continue reading

06
Mar
2011
2

Microbenchmarking and you

Microbenchmarking is the practice of measuring the performance characteristics (like CPU, memory or I/O) of a small piece of code to determine which would be better suited for a particular scenario. If I could offer but one advice on this, … Continue reading

06
Mar
2011
1

How to test for the implementation of toString()

Problem statement: you have some value objects for which you implemented toString() (for debugging purposes) and now you would like to test using a unit test that these implementations exist. Possible solutions: – Use reflection to detect the existence of … Continue reading

22
Feb
2011
8

Reasons to call .isEmpty on collections

I’ve seen many times code like the one below: 1 if (collection.size() > 0) { … }if (collection.size() > 0) { … } There is just something which inherently “clicks” with most programmers minds when they think “non-empty”. There is … Continue reading

df