void terminate() {}
protected JFrame frame = new JFrame();
Run Code Online (Sandbox Code Playgroud)
frame
当我按下关闭按钮时,如何运行终止功能?
编辑:我试图运行它,但由于某种原因它不打印测试(但程序关闭).有谁知道可能是什么问题?
frame.addWindowListener(new WindowAdapter() {
public void WindowClosing(WindowEvent e) {
System.out.println("test");
frame.dispose();
}
});
Run Code Online (Sandbox Code Playgroud) 有没有办法让某些测试与JUnit的surefire插件一起按顺序运行?当前,它正在并行运行所有测试,但是有些测试很难转换,如果不并行运行就足够了。这是我们pom.xml的一部分:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.17</version>
</dependency>
</dependencies>
<configuration>
<parallel>all</parallel>
<threadCount>8</threadCount>
<includes>
<include>${includeTest}</include>
<include>${includeAdditionalTest}</include>
</includes>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我想在我的Java代码中使用@ net.jcip.annotations.NotThreadSafe。我尝试将其导入项目的pom.xml中,如下所示。但是,我仍然收到错误:导入有问题吗?
包net.jcip.annotations不存在
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18</version>
</dependency>
<dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<configuration>
{...}
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)