[Misc] More unit tests and conversion to Mockito