@Test(expected = RuntimeException.class) public void testUpdateRawThrow() throws Exception { @SuppressWarnings("unchecked") Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class); RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao); expect(dao.updateRaw(null)).andThrow(new SQLException("Testing catch")); replay(dao); rtDao.updateRaw(null); verify(dao); }
@Override public int updateRaw(String statement, String... arguments) { try { return dao.updateRaw(statement, arguments); } catch (SQLException e) { logMessage(e, "updateRaw threw exception on: " + statement); throw new RuntimeException(e); } }
RuntimeExceptionDao implements Dao<T, ID> { @Override public int updateRaw(String statement, String... arguments) { try { return dao.updateRaw(statement, arguments); } catch (SQLException e) { logMessage(e, "updateRaw threw exception on: " + statement); throw new RuntimeException(e); } } }
RuntimeExceptionDao implements Dao<T, ID> { @Override public int updateRaw(String statement, String... arguments) { try { return dao.updateRaw(statement, arguments); } catch (SQLException e) { logMessage(e, "updateRaw threw exception on: " + statement); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); }
RuntimeExceptionDao implements Dao<T, ID> { @Override public int updateRaw(String statement, String... arguments) { try { return dao.updateRaw(statement, arguments); } catch (SQLException e) { logMessage(e, "updateRaw threw exception on: " + statement); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz); static RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource,
			DatabaseTableConfig<T> tableConfig); @Override T queryForId(ID id); @Override T queryForFirst(PreparedQuery<T> preparedQuery); @Override List<T> queryForAll(); @Override List<T> queryForEq(String fieldName, Object value); @Override List<T> queryForMatching(T matchObj); @Override List<T> queryForMatchingArgs(T matchObj); @Override List<T> queryForFieldValues(Map<String, Object> fieldValues); @Override List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues); @Override T queryForSameId(T data); @Override QueryBuilder<T, ID> queryBuilder(); @Override UpdateBuilder<T, ID> updateBuilder(); @Override DeleteBuilder<T, ID> deleteBuilder(); @Override List<T> query(PreparedQuery<T> preparedQuery); @Override int create(T data); @Override int create(Collection<T> datas); @Override T createIfNotExists(T data); @Override CreateOrUpdateStatus createOrUpdate(T data); @Override int update(T data); @Override int updateId(T data, ID newId); @Override int update(PreparedUpdate<T> preparedUpdate); @Override int refresh(T data); @Override int delete(T data); @Override int deleteById(ID id); @Override int delete(Collection<T> datas); @Override int deleteIds(Collection<ID> ids); @Override int delete(PreparedDelete<T> preparedDelete); @Override CloseableIterator<T> iterator(); @Override CloseableIterator<T> closeableIterator(); @Override CloseableIterator<T> iterator(int resultFlags); @Override CloseableWrappedIterable<T> getWrappedIterable(); @Override CloseableWrappedIterable<T> getWrappedIterable(PreparedQuery<T> preparedQuery); @Override void closeLastIterator(); @Override CloseableIterator<T> iterator(PreparedQuery<T> preparedQuery); @Override CloseableIterator<T> iterator(PreparedQuery<T> preparedQuery, int resultFlags); @Override GenericRawResults<String[]> queryRaw(String query, String... arguments); @Override long queryRawValue(String query, String... arguments); @Override GenericRawResults<UO> queryRaw(String query, RawRowMapper<UO> mapper, String... arguments); @Override GenericRawResults<UO> queryRaw(String query, DataType[] columnTypes, RawRowObjectMapper<UO> mapper,
			String... arguments); @Override GenericRawResults<Object[]> queryRaw(String query, DataType[] columnTypes, String... arguments); @Override GenericRawResults<UO> queryRaw(String query, DatabaseResultsMapper<UO> mapper, String... arguments); @Override int executeRaw(String statement, String... arguments); @Override int executeRawNoArgs(String statement); @Override int updateRaw(String statement, String... arguments); @Override CT callBatchTasks(Callable<CT> callable); @Override String objectToString(T data); @Override boolean objectsEqual(T data1, T data2); @Override ID extractId(T data); @Override Class<T> getDataClass(); @Override FieldType findForeignFieldType(Class<?> clazz); @Override boolean isUpdatable(); @Override boolean isTableExists(); @Override long countOf(); @Override long countOf(PreparedQuery<T> preparedQuery); @Override void assignEmptyForeignCollection(T parent, String fieldName); @Override ForeignCollection<FT> getEmptyForeignCollection(String fieldName); @Override void setObjectCache(boolean enabled); @Override ObjectCache getObjectCache(); @Override void setObjectCache(ObjectCache objectCache); @Override void clearObjectCache(); @Override T mapSelectStarRow(DatabaseResults results); @Override GenericRowMapper<T> getSelectStarRowMapper(); @Override boolean idExists(ID id); @Override DatabaseConnection startThreadConnection(); @Override void endThreadConnection(DatabaseConnection connection); @Override void setAutoCommit(DatabaseConnection connection, boolean autoCommit); @Override boolean isAutoCommit(DatabaseConnection connection); @Override void commit(DatabaseConnection connection); @Override void rollBack(DatabaseConnection connection); @Override void setObjectFactory(ObjectFactory<T> objectFactory); @Override RawRowMapper<T> getRawRowMapper(); @Override ConnectionSource getConnectionSource(); @Override void registerObserver(DaoObserver observer); @Override void unregisterObserver(DaoObserver observer); @Override void notifyChanges(); @Override String getTableName(); }
RuntimeExceptionDao implements Dao<T, ID> { @Override public int updateRaw(String statement, String... arguments) { try { return dao.updateRaw(statement, arguments); } catch (SQLException e) { logMessage(e, "updateRaw threw exception on: " + statement); throw new RuntimeException(e); } } RuntimeExceptionDao(Dao<T, ID> dao); static RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz); static RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource,
			DatabaseTableConfig<T> tableConfig); @Override T queryForId(ID id); @Override T queryForFirst(PreparedQuery<T> preparedQuery); @Override List<T> queryForAll(); @Override List<T> queryForEq(String fieldName, Object value); @Override List<T> queryForMatching(T matchObj); @Override List<T> queryForMatchingArgs(T matchObj); @Override List<T> queryForFieldValues(Map<String, Object> fieldValues); @Override List<T> queryForFieldValuesArgs(Map<String, Object> fieldValues); @Override T queryForSameId(T data); @Override QueryBuilder<T, ID> queryBuilder(); @Override UpdateBuilder<T, ID> updateBuilder(); @Override DeleteBuilder<T, ID> deleteBuilder(); @Override List<T> query(PreparedQuery<T> preparedQuery); @Override int create(T data); @Override int create(Collection<T> datas); @Override T createIfNotExists(T data); @Override CreateOrUpdateStatus createOrUpdate(T data); @Override int update(T data); @Override int updateId(T data, ID newId); @Override int update(PreparedUpdate<T> preparedUpdate); @Override int refresh(T data); @Override int delete(T data); @Override int deleteById(ID id); @Override int delete(Collection<T> datas); @Override int deleteIds(Collection<ID> ids); @Override int delete(PreparedDelete<T> preparedDelete); @Override CloseableIterator<T> iterator(); @Override CloseableIterator<T> closeableIterator(); @Override CloseableIterator<T> iterator(int resultFlags); @Override CloseableWrappedIterable<T> getWrappedIterable(); @Override CloseableWrappedIterable<T> getWrappedIterable(PreparedQuery<T> preparedQuery); @Override void closeLastIterator(); @Override CloseableIterator<T> iterator(PreparedQuery<T> preparedQuery); @Override CloseableIterator<T> iterator(PreparedQuery<T> preparedQuery, int resultFlags); @Override GenericRawResults<String[]> queryRaw(String query, String... arguments); @Override long queryRawValue(String query, String... arguments); @Override GenericRawResults<UO> queryRaw(String query, RawRowMapper<UO> mapper, String... arguments); @Override GenericRawResults<UO> queryRaw(String query, DataType[] columnTypes, RawRowObjectMapper<UO> mapper,
			String... arguments); @Override GenericRawResults<Object[]> queryRaw(String query, DataType[] columnTypes, String... arguments); @Override GenericRawResults<UO> queryRaw(String query, DatabaseResultsMapper<UO> mapper, String... arguments); @Override int executeRaw(String statement, String... arguments); @Override int executeRawNoArgs(String statement); @Override int updateRaw(String statement, String... arguments); @Override CT callBatchTasks(Callable<CT> callable); @Override String objectToString(T data); @Override boolean objectsEqual(T data1, T data2); @Override ID extractId(T data); @Override Class<T> getDataClass(); @Override FieldType findForeignFieldType(Class<?> clazz); @Override boolean isUpdatable(); @Override boolean isTableExists(); @Override long countOf(); @Override long countOf(PreparedQuery<T> preparedQuery); @Override void assignEmptyForeignCollection(T parent, String fieldName); @Override ForeignCollection<FT> getEmptyForeignCollection(String fieldName); @Override void setObjectCache(boolean enabled); @Override ObjectCache getObjectCache(); @Override void setObjectCache(ObjectCache objectCache); @Override void clearObjectCache(); @Override T mapSelectStarRow(DatabaseResults results); @Override GenericRowMapper<T> getSelectStarRowMapper(); @Override boolean idExists(ID id); @Override DatabaseConnection startThreadConnection(); @Override void endThreadConnection(DatabaseConnection connection); @Override void setAutoCommit(DatabaseConnection connection, boolean autoCommit); @Override boolean isAutoCommit(DatabaseConnection connection); @Override void commit(DatabaseConnection connection); @Override void rollBack(DatabaseConnection connection); @Override void setObjectFactory(ObjectFactory<T> objectFactory); @Override RawRowMapper<T> getRawRowMapper(); @Override ConnectionSource getConnectionSource(); @Override void registerObserver(DaoObserver observer); @Override void unregisterObserver(DaoObserver observer); @Override void notifyChanges(); @Override String getTableName();  }