### Question:
VCellThreadChecker { public static void checkCpuIntensiveInvocation() { if (guiThreadChecker == null){ System.out.println("!!!!!!!!!!!!!! --VCellThreadChecker.setGUIThreadChecker() not set"); Thread.dumpStack(); }else if (guiThreadChecker.isEventDispatchThread() && cpuSuppressed.get() == 0) { System.out.println("!!!!!!!!!!!!!! --calling cpu intensive method from swing thread-----"); Thread.dumpStack(); } }  static void setGUIThreadChecker(GUIThreadChecker argGuiThreadChecker); static void checkRemoteInvocation(); static void checkSwingInvocation(); static void checkCpuIntensiveInvocation();  }### Answer:
@Test public void notSwingCheck( ) { VCellThreadChecker.checkCpuIntensiveInvocation(); checkQuiet( ); }
@Test public void swingCheckSupp( ) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { try (VCellThreadChecker.SuppressIntensive si = new VCellThreadChecker.SuppressIntensive()) { subCall( ); VCellThreadChecker.checkCpuIntensiveInvocation(); } } }); checkQuiet( ); }
@Test(expected=IllegalStateException.class) public void swingCheckNotSupp( ) throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { try (VCellThreadChecker.SuppressIntensive si = new VCellThreadChecker.SuppressIntensive()) { } VCellThreadChecker.checkCpuIntensiveInvocation(); } }); checkQuiet( ); }