📄 showninterceptiondetectionhandler.java
字号:
package org.uispec4j.interception.handlers;
import junit.framework.Assert;
import org.uispec4j.Window;
import org.uispec4j.utils.Utils;
public class ShownInterceptionDetectionHandler extends AbstractInterceptionHandlerDecorator {
public static final String NO_WINDOW_WAS_SHOWN_ERROR_MESSAGE = "No window was shown (timeout expired)";
private boolean windowWasShown = false;
private long waitTimeLimit;
public ShownInterceptionDetectionHandler(InterceptionHandler handler, long waitTimeLimit) {
super(handler);
this.waitTimeLimit = waitTimeLimit;
}
public void process(Window window) {
windowWasShown = true;
super.process(window);
}
public void waitWindow() {
long step = waitTimeLimit / 100;
for (int i = 0; i < 100; i++) {
if (windowWasShown) {
return;
}
Utils.sleep(step);
}
Assert.fail(NO_WINDOW_WAS_SHOWN_ERROR_MESSAGE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -