我无法在IterableIntegerArrays类中测试hasNext()方法。如果我在IterableIntegerArraysTestCases中调用此方法,则表示"找不到符号"。我该如何解决这个错误?
public class IterableIntegerArrays extends IntegerRelation implements Iterable<IntPair> {
public IterableIntegerArrays(int n) {
super(n);
}
@Override
public Iterator<IntPair> iterator() {
return new Iterator<IntPair>() {
@Override
public boolean hasNext() {
//implementation
return false;
}
@Override
public IntPair next() {
//implementation
}
};
}
}
-
public abstract class IterableIntegerArraysTestCases extends IntegerRelationTestCases {
protected Iterable<IntPair> iterable;
protected void setIterable(final int n) {
setInstance(n);
iterable = ((Iterable<IntPair>) instance);
}
private void checkHasNext(int a, int b, boolean expResult) {
boolean result = iterable.hasNext(); //It says "cannot find symbol" here
assertEquals("hasNext(" + a + ", " + b + ")", expResult, result);
}
}