Junit test cases for mongodb. Fixed error checking in MongoPortal to be effective