In DAO class
catch (Exception e) { throw new DaoException(e); } In Junit Class
@Test public void testClass() throws DaoException { try { doThrow(Exception.class).when(testDAO).getTestData(); testDAO.getTestData(); } catch (Exception e) { e.printStackTrace(); } } Unable to cover DaoException.Could you please help me to cover DAOException in JUNIT.