@Test public void testIfAllMethodsAreThere() { List<String> failedMessages = new ArrayList<String>(); List<Method> runtimeMethods = new ArrayList<Method>(Arrays.asList(RuntimeExceptionDao.class.getDeclaredMethods())); List<Method> daoMethods = new ArrayList<Method>(Arrays.asList(Dao.class.getDeclaredMethods())); daoMethods.addAll(Arrays.asList(CloseableIterable.class.getDeclaredMethods())); daoMethods.addAll(Arrays.asList(Iterable.class.getDeclaredMethods())); Iterator<Method> daoIterator = daoMethods.iterator(); while (daoIterator.hasNext()) { Method daoMethod = daoIterator.next(); boolean found = false; if (daoMethod.getName().equals("$VRi") || daoMethod.getName().equals("spliterator") || daoMethod.getName().equals("forEach") ) { continue; } Iterator<Method> runtimeIterator = runtimeMethods.iterator(); while (runtimeIterator.hasNext()) { Method runtimeMethod = runtimeIterator.next(); if (daoMethod.getName().equals(runtimeMethod.getName()) && Arrays.equals(daoMethod.getParameterTypes(), runtimeMethod.getParameterTypes()) && daoMethod.getReturnType().equals(runtimeMethod.getReturnType())) { found = true; daoIterator.remove(); runtimeIterator.remove(); break; } } if (!found) { failedMessages.add(RuntimeExceptionDao.class.getName() + " did not include method: " + daoMethod); } } for (Method runtimeMethod : runtimeMethods) { if (runtimeMethod.getName().startsWith("$")) { continue; } if (runtimeMethod.getName().equals("createDao") || runtimeMethod.getName().equals("logMessage")) { continue; } failedMessages.add("Unknown RuntimeExceptionDao method: " + runtimeMethod); } if (!failedMessages.isEmpty()) { for (String message : failedMessages) { System.err.println(message); } fail(failedMessages.get(0) + ", see the console for more"); } }
@Override public CloseableIterator<T> iterator() { return dao.iterator(); }
RuntimeExceptionDao implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return dao.iterator(); } }
RuntimeExceptionDao implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return dao.iterator(); } RuntimeExceptionDao(Dao<T, ID> dao); }
RuntimeExceptionDao implements Dao<T, ID> { @Override public CloseableIterator<T> iterator() { return dao.iterator(); } 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 CloseableIterator<T> iterator() { return dao.iterator(); } 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();  }