gpt4 book ai didi

Maven 无法从具有多个接口(interface)的类中加载 JUnit 类别的组?

转载 作者:行者123 更新时间:2023-12-05 01:07:59 25 4
gpt4 key购买 nike

我的专家:

            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<groups>
com.rubberduck.TestState.Ready
</groups>
</configuration>
</plugin>

我的课:
package com.rubberduck;
public class TestState
{
public interface Ready {
/* to allow filter ready tests as groups */
}
public interface InProgress {
/* to allow filter ready tests as groups */
}
public interface NotTested {
/* to allow filter ready tests as groups */
}
}

我的测试:
@Test(timeout = 60000)
@Category(TestState.Ready.class)
public void test() throws Exception {
assertEquals(true, true);
}

我的错误:
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14.1:test (default-cli) on project rubberduck: Execution default-cli of goal org.apache.maven.plugins:maven-surefire-plugin:2.14.1:test failed: There was an error in the forked process
java.lang.RuntimeException: Unable to load category: com.rubberduck.TestState.Ready

如果我给他 <groups>com.rubberduck.TestState</groups>它编译没有错误,但我想在同一个类中为组有多个接口(interface),这不可能吗?

最佳答案

您可以像这样在类中指定接口(interface):

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<groups>
com.rubberduck.TestState$Ready
</groups>
</configuration>
</plugin>

关于Maven 无法从具有多个接口(interface)的类中加载 JUnit 类别的组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17695484/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com