SearchScopeListTest.java 文件源码

java
阅读 32 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
public void testSearchScopesNotifiedAboutChangesInEDT()
        throws InterruptedException {
    CustomSearchScope css = new CustomSearchScope(true, 1);
    SearchScopeList ssl = new SearchScopeList(css);
    final Semaphore s = new Semaphore(0);
    final AtomicBoolean notifiedInEDT = new AtomicBoolean(false);
    ssl.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            notifiedInEDT.set(EventQueue.isDispatchThread());
            s.release();
        }
    });
    css.fireChangeEvent();
    boolean acqrd = s.tryAcquire(10, TimeUnit.SECONDS);
    assertTrue("Should be notified in EDT", acqrd && notifiedInEDT.get());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号