/** * Executes the {@link Runnable#run()} method on provided argument and verifies the expectations * @throws SniffyAssertionError if wrong number of queries was executed * @since 2.0 */ public C run(Runnable runnable) throws SniffyAssertionError { checkOpened(); try { runnable.run(); } catch (Throwable e) { throw verifyAndAddToException(e); } verify(); return self(); }
/** * Executes the {@link Callable#call()} method on provided argument and verifies the expectations * @throws SniffyAssertionError if wrong number of queries was executed * @since 2.0 */ public <V> SpyWithValue<V> call(Callable<V> callable) throws SniffyAssertionError { checkOpened(); V result; try { result = callable.call(); } catch (Throwable e) { throw verifyAndAddToException(e); } verify(); return new SpyWithValue<V>(result); }
/** * Executes the {@link Runnable#run()} method on provided argument and verifies the expectations * @throws SniffyAssertionError if wrong number of queries was executed * @since 2.0 */ public C run(Runnable runnable) throws SniffyAssertionError { checkOpened(); try { runnable.run(); } catch (Throwable e) { throw verifyAndAddToException(e); } verify(); return self(); }
/** * Executes the {@link Callable#call()} method on provided argument and verifies the expectations * @throws SniffyAssertionError if wrong number of queries was executed * @since 2.0 */ public <V> SpyWithValue<V> call(Callable<V> callable) throws SniffyAssertionError { checkOpened(); V result; try { result = callable.call(); } catch (Throwable e) { throw verifyAndAddToException(e); } verify(); return new SpyWithValue<V>(result); }
/** * Executes the {@link io.sniffy.Executable#execute()} method on provided argument and verifies the expectations * @throws SniffyAssertionError if wrong number of queries was executed * @since 3.1 */ @Override public C execute(io.sniffy.Executable executable) throws SniffyAssertionError { checkOpened(); try { executable.execute(); } catch (Throwable e) { throw verifyAndAddToException(e); } verify(); return self(); }
/** * Executes the {@link io.sniffy.Executable#execute()} method on provided argument and verifies the expectations * @throws SniffyAssertionError if wrong number of queries was executed * @since 3.1 */ @Override public C execute(io.sniffy.Executable executable) throws SniffyAssertionError { checkOpened(); try { executable.execute(); } catch (Throwable e) { throw verifyAndAddToException(e); } verify(); return self(); }