コード例 #1
0
 @Test(expected = MongoException.class)
 public void createConnectionException2Test() {
   try {
     when(mongo.getDB(anyString())).thenThrow(MongoException.class);
   } catch (Exception ex) {
     fail(ex.getLocalizedMessage());
   }
   MongoDAOFactory.createConnection();
 }
コード例 #2
0
 @Test
 public void getResourceDAOTest() {
   mongoResourceDAO = mock(MongoResourceDAO.class);
   try {
     PowerMockito.whenNew(MongoResourceDAO.class).withNoArguments().thenReturn(mongoResourceDAO);
   } catch (Exception ex) {
     fail(ex.getLocalizedMessage());
   }
   toTest = new MongoDAOFactory();
   toTest.getResourceDAO();
 }
コード例 #3
0
 @Test
 public void createConnection3Test() {
   MongoDAOFactory.createConnection();
   verify(mongo).getDB(anyString());
 }