问题描述
我使用 TestNG 进行单元测试。它在 Java8 上运行良好,但是当我升级到 Java 11 时,出现以下错误:
[ERROR] test(com.dhruv.test.service.impl.ThirdPartyIntegrationServiceImpltest) Time elapsed: 0.045 s <<< FAILURE!
java.lang.Arrayindexoutofboundsexception: Index 37130 out of bounds for length 153
下面是 pom.xml 中的 maven-surefire-plugin
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<it.db_port>${db_port}</it.db_port>
<it.redis_port>${redis_port}</it.redis_port>
<it.service_port>${service.port}</it.service_port>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng-unit.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>bitbucket</id>
</profile>
</profiles>
测试类:
import static org.testng.Assert.assertTrue;
import org.testng.annotations.Test;
import com.dhruv.service.impl.ThirdPartyIntegrationServiceImpl;
import mockit.Tested;
public class ThirdPartyIntegrationServiceImpltest {
@Tested
private ThirdPartyIntegrationServiceImpl integrationService;
@Test
public void test() {
assertTrue(Boolean.TRUE);
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)