📄 windowinterceptiontest.java
字号:
package org.uispec4j.interception;
import junit.framework.AssertionFailedError;
import org.uispec4j.utils.AssertionFailureNotDetectedError;
import org.uispec4j.utils.Utils;
import javax.swing.*;
public class WindowInterceptionTest extends InterceptionTestCase {
public void testShowingAnUnexpectedWindow() throws Exception {
JFrame frame = new JFrame();
String frameTitle = "frame(" + getName() + ")";
frame.setTitle(frameTitle);
frame.getContentPane().add(new JButton("OK"));
try {
frame.setVisible(true);
throw new AssertionFailureNotDetectedError();
}
catch (AssertionFailedError e) {
assertEquals("Unexpected window shown - this window should be handled with WindowInterceptor. " +
"Window contents:" +
"<window title=\"" + frameTitle + "\">" +
"<button label=\"OK\"/></window>",
e.getMessage().replaceAll(Utils.LINE_SEPARATOR, ""));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -