如何解决TestNg:在 Java 11 上获取 java.lang.ArrayIndexOutOfBoundsException
我使用 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 举报,一经查实,本站将立刻删除。