@Test(expected = MongoException.class) public void createConnectionException2Test() { try { when(mongo.getDB(anyString())).thenThrow(MongoException.class); } catch (Exception ex) { fail(ex.getLocalizedMessage()); } MongoDAOFactory.createConnection(); }
@Test public void createConnection3Test() { MongoDAOFactory.createConnection(); verify(mongo).getDB(anyString()); }