Add Junit test

Also found a small problem from the query by running this first test
case.