如何在 jUnit 测试中使用下面方法中的 2 个变量,但 Eclipse 告诉我无法访问该变量。我怎样才能以任何方式使其可访问?或者我需要在其他类中定义测试?
import org.junit.Assert;
import org.junit.*;
public class Sequence {
public void MissingNumber() {
int[] arr = {1, 2, 3, 5, 6, 7, 8};
int length = arr.length;
int indexes = 8;
int values = 0;
for (int i = 0; i < length; i++) {
indexes += i+1;
values += arr[i];
int result = indexes - values;
System.out.println("Indexes:" + indexes);
System.out.println("Values:" + values);
System.out.println("Missing number is: "+ result);
}
}
@Test
public void testCase1() …Run Code Online (Sandbox Code Playgroud) 我刚刚浏览了下面的链接。
使用的好处是JPAMetaModelEntityProcessor什么?
谢谢!