/** * Installs a <code>{@link FailOnThreadViolationRepaintManager}</code> to catch violations of Swing threading rules. */ @BeforeClass(alwaysRun = true) public final void setUpOnce() { FailOnThreadViolationRepaintManager.install(); }
/** * Removes the <code>{@link FailOnThreadViolationRepaintManager}</code> again to allow EDT violating and EDT safe * tests in the same suite. */ @AfterClass(alwaysRun = true) public static final void tearDownOnce() { FailOnThreadViolationRepaintManager.uninstall(); }
@Nonnull private static FailOnThreadViolationRepaintManager installNew() { FailOnThreadViolationRepaintManager m = new FailOnThreadViolationRepaintManager(); previousRepaintManager = currentRepaintManager(); setCurrentManager(m); return m; }
/** * <p> * Creates a new {@link FailOnThreadViolationRepaintManager} and sets it as the current repaint manager. * </p> * * <p> * On Sun JVMs, this method will install the new repaint manager the first time only. Once installed, subsequent calls * to this method will not install new repaint managers. This optimization may not work on non-Sun JVMs, since we use * reflection to check if a {@code CheckThreadViolationRepaintManager} is already installed. * </p> * * @return the created (and installed) repaint manager. * @see #uninstall() * @see RepaintManager#setCurrentManager(RepaintManager) */ @Nonnull public static FailOnThreadViolationRepaintManager install() { Object m = currentRepaintManager(); if (m instanceof FailOnThreadViolationRepaintManager) { return (FailOnThreadViolationRepaintManager) m; } return installNew(); }
/** * <p> * Tries to restore the repaint manager before installing the {@link FailOnThreadViolationRepaintManager} via * {@link #install()}. * </p> * * @return the restored (and installed) repaint manager. * @see #install() * @see RepaintManager#setCurrentManager(RepaintManager) */ @Nonnull public static RepaintManager uninstall() { RepaintManager restored = previousRepaintManager; setCurrentManager(restored); previousRepaintManager = null; return restored; }
/** * Installs a <code>{@link FailOnThreadViolationRepaintManager}</code> to catch violations of Swing threading rules. */ @BeforeClass public static final void setUpOnce() { FailOnThreadViolationRepaintManager.install(); }
/** * Removes the <code>{@link FailOnThreadViolationRepaintManager}</code> again to allow EDT violating and EDT safe * tests in the same suite. */ @AfterClass public static final void tearDownOnce() { FailOnThreadViolationRepaintManager.uninstall(); }
/** * Installs a <code>{@link FailOnThreadViolationRepaintManager}</code> to catch violations of Swing threading rules. */ @BeforeClass public static final void setUpOnce() { FailOnThreadViolationRepaintManager.install(); }
/** * Removes the <code>{@link FailOnThreadViolationRepaintManager}</code> again to allow EDT violating and EDT safe * tests in the same suite. */ @AfterClass public static final void tearDownOnce() { FailOnThreadViolationRepaintManager.uninstall(); }