在本节中,您将使用内容辅助来填写公共循环结构的模板。如果尚未打开 junit.samples.VectorTest.java 文件,则在 Java 编辑器中打开它。
public void testValues() {
Integer[] expected= new Integer[3];
for
for 末尾的情况下,按 Ctrl+空格键以启用内容辅助。您将看到“for”循环的公共模板的列表。当单击模板时,您将在模板的帮助消息中看到模板的代码。注意,将自动猜测局部数组名。

for - 数组迭代条目并按 Enter 键以确认该模板。将在源代码中插入该模板。



for 循环:
for (int e= 0; e < expected.length; e++) {
expected[e]= new Integer(e + 1);
}
Integer[] actual= to
to 末尾的情况下,按 Ctrl+空格键以启用内容辅助。选取 toarray - 将集合转换为数组并按 Enter 键以确认选择(或双击选择)。

type。

Integer 覆盖选择。当您更改选择时,数组构造函数的类型也将更改。 collection,并通过输入 fFull 覆盖它。

assertEquals(expected.length, actual.length);
for (int i= 0; i < actual.length; i++)
assertEquals(expected[i], actual[i]);