Karen Johnson has a great post on 9 numbers that she likes to start with when testing something that takes a numeric input. It is nice short description of why these values are useful in testing.

It reminded me of a utility used for generating skeleton junit classes, junitdoclet. One feature is passing various values into setters and verifying the value using the getters. How this relates to Karen’s post is that within the utility is a data file that has the values to use for various data types. The file, junitdoclet.properties, is found in the root directory of the jar.

Since this is a junit related tool and java has compile time type checking, you cannot pass a float to a method that only takes an integer. For the numeric types, these are the values junitdoclet uses:

byte Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE
double Double.MIN_VALUE, -1.0, -0.5, 0.0, 0.5, 1.0, Double.MAX_VALUE
float Float.MIN_VALUE, -1.0f, -0.5f, 0.0f, 0.5f, 1.0f, Float.MAX_VALUE
int Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE
long Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE
short Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE

The non-numeric data type values junit doclet uses are:

boolean true, false
char ‘ ‘, ‘a’, ‘A’, ‘z’, ‘Z’, ‘ä’, ‘\n’, ‘ß’, ‘?’
string “” (empty string), ” ” (blank character string), “a”, “A”, “ä”, “ß”, “0123456789”, “012345678901234567890”, “\n”, null
date new java.util.Date(), new java.util.Date(0), null

In a later post, I will put in some of the values I like to use.