Fix some broken tests. Upgrade many tests to junit 4.