0

在我试图获取静态 ArrayList<ArrayList> 的值的类中显示错误相邻_list_train=new ArrayList<ArrayList>(); 返回错误,例如: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1. 问题出在静态变量上吗?

class Node{

    
    static ArrayList<ArrayList<TrainVertices>> adjacent_list_train=new ArrayList<ArrayList<TrainVertices>>(); 
public void CList(){
      //error thrown at the following line
    if(FlightEdges.size>0) {
            if(!adjacent_list.isEmpty()) {
                for(int i=0;i<adjacent_list.size();i++) {
//error line
                    ArrayList<FlightEdges> fe_al=adjacent_list.get(i);
}
}

根据我的观察,这与在多个测试类中访问静态变量有关。由于我是junit测试的新手,你能告诉我测试类有什么问题吗

4

0 回答 0