JUnit tests and clean up