modalinterceptioncheckerhandler.java

来自「基于Junit的 功能和单元测试的的测试工具。只支持Swing.」· Java 代码 · 共 28 行

JAVA
28
字号
package org.uispec4j.interception.handlers;

import junit.framework.Assert;
import org.uispec4j.Window;

public class ModalInterceptionCheckerHandler extends AbstractInterceptionHandlerDecorator {
  private boolean shouldBeModal;

  public ModalInterceptionCheckerHandler(InterceptionHandler innerHandler, boolean shouldBeModal) {
    super(innerHandler);
    this.shouldBeModal = shouldBeModal;
  }

  public void process(Window window) {
    if (!shouldBeModal) {
      if (window.isModal().isTrue()) {
        Assert.fail("Window '" + window.getTitle() + "' is modal, it must be intercepted with a WindowHandler");
      }
    }
    else {
      if (!window.isModal().isTrue()) {
        Assert.fail("Window '" + window.getTitle() + "' is non-modal, it must be intercepted with WindowInterceptor.run(Trigger)");
      }
    }
    super.process(window);
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?