/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce() * @since 2.0 */ @Deprecated public static Spy expectAtMostOnce() { return spy().expectAtMostOnce(); }
/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce(Query) * @since 2.2 */ @Deprecated public static Spy expectAtMostOnce(Query query) { return spy().expectAtMostOnce(query); }
/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce(Threads) * @since 2.0 */ @Deprecated public static Spy expectAtMostOnce(Threads threadMatcher) { return spy().expectAtMostOnce(threadMatcher); }
/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce(Threads, Query) * @since 2.2 */ @Deprecated public static Spy expectAtMostOnce(Threads threadMatcher, Query query) { return spy().expectAtMostOnce(threadMatcher, query); }
/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce(Threads, Query) * @since 2.2 */ @Deprecated public static Spy expectAtMostOnce(Query query, Threads threadMatcher) { return spy().expectAtMostOnce(query, threadMatcher); }
/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce(Query) * @since 2.2 */ @Deprecated public static Spy expectAtMostOnce(Query query) { return spy().expectAtMostOnce(query); }
/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce(Threads, Query) * @since 2.2 */ @Deprecated public static Spy expectAtMostOnce(Query query, Threads threadMatcher) { return spy().expectAtMostOnce(query, threadMatcher); }
/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce() * @since 2.0 */ @Deprecated public static Spy expectAtMostOnce() { return spy().expectAtMostOnce(); }
/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce(Threads, Query) * @since 2.2 */ @Deprecated public static Spy expectAtMostOnce(Threads threadMatcher, Query query) { return spy().expectAtMostOnce(threadMatcher, query); }
/** * @return a new {@link Spy} instance with an expectation initialized * @see #spy() * @see Spy#expectAtMostOnce(Threads) * @since 2.0 */ @Deprecated public static Spy expectAtMostOnce(Threads threadMatcher) { return spy().expectAtMostOnce(threadMatcher); }
@Test public void testSpyClosed() throws Exception { Spy spy = Sniffer.execute(() -> { executeStatement(); Thread thread = new Thread(BaseTest::executeStatement); thread.start(); thread.join(); }).expectAtMostOnce(Threads.OTHERS); spy.close(); try { spy.verify(1); } catch (Spy.SpyClosedException e) { assertNotNull(e); assertNotNull(e.getCloseStackTrace()); assertNotNull(e.getCloseStackTrace()[1]); StackTraceElement stackTraceElement = e.getCloseStackTrace()[1]; assertEquals("io.sniffy.SnifferTest", stackTraceElement.getClassName()); assertEquals("testSpyClosed", stackTraceElement.getMethodName()); } }