[tests] some refactoring to use junit4 and other fixups