运行EvoSuite(java自动单元测试生成)时出现异常InInitializeError
我有以下非常简单的、故意有缺陷的java类:运行EvoSuite(java自动单元测试生成)时出现异常InInitializeError,java,exception,Java,Exception,我有以下非常简单的、故意有缺陷的java类: import java.io.InputStream; import java.util.*; public class ArrayListError{ public ArrayListError(){ } public static void makeArray(int i){ ArrayList list = new ArrayList(i); } public static void main(String[] args) { System.
import java.io.InputStream;
import java.util.*;
public class ArrayListError{
public ArrayListError(){
}
public static void makeArray(int i){
ArrayList list = new ArrayList(i);
}
public static void main(String[] args)
{
System.out.println("Enter a number to create arrayList:");
Scanner scanner =new Scanner(System.in);
int i= scanner.nextInt();
makeArray(i);
}
}
在evosuite cygwin上运行时(java-jar evosuite-20120511.jar-setup c:/Users/elizer\Shindler/Desktop/myclasses)
我得到:
线程“main”java.lang.ExceptionInInitializeError中出现异常
位于de.unisb.cs.st.evosuite.setup.ScanProject.main(ScanProject.java:578)
原因:com.thoughtworks.xstream.converters.ConversionException:无法构造de.unisb.cs.st.evosuite.callgraph.DistanceTransformer$ClassEntry,因为它没有无参数构造函数:无法构造de.unisb.cs.st.evosuite.callg-Graph.DistanceTransformer$ClassEntry,因为它没有无参数建造师
----调试信息----
消息:无法构造de.unisb.cs.st.evosuite.callgraph.Distanc eTransformer$ClassEntry,因为它没有无参数构造函数
原因异常:com.thoughtworks.xstream.converters.reflection.ObjectAcces sException
原因消息:无法构造de.unisb.cs.st.evosuite.callgraph.Distanc eTransformer$ClassEntry,因为它没有无参数构造函数
类:java.util.HashSet
所需类型:de.unisb.cs.st.evosuite.callgraph.DistanceTransformer$Clas sEntry
路径:/set/de.unisb.cs.st.evosuite.callgraph.DistanceTransformer$ClassEntry
行号:2
位于com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:89)
位于com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(bstractReferenceUnmarshaller.java:63)
位于com.thoughtworks.xstream.core.TreeUnmarshaller.convertOther(TreeUnmarshaller.java:76)
位于com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:60)
在com.thoughtworks.xstream.converts.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)上
在com.thoughtworks.xstream.converters.collections.CollectionConverter.p OpulatCollection(CollectionConverter.java:68)上
位于com.thoughtworks.xstream.converters.collections.CollectionConverter.u nmarshal(CollectionConverter.java:61)
位于com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
位于com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(bstractReferenceUnmarshaller.java:63)
位于com.thoughtworks.xstream.core.TreeUnmarshaller.convertOther(TreeUnmarshaller.java:76)
位于com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:60)
位于com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:137)
位于com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarsh al(AbstractTreeMarshallingStrategy.java:33)
位于com.thoughtworks.xstream.xstream.unmarshal(xstream.java:923)
位于com.thoughtworks.xstream.xstream.unmarshal(xstream.java:909)
位于com.thoughtworks.xstream.xstream.fromXML(xstream.java:853)
位于de.unisb.cs.st.evosuite.utils.utils.readXML(utils.java:301)
位于de.unisb.cs.st.evosuite.callgraph.Hierarchy.readFromDefaultLocation(H ierarch.java:113)
位于de.unisb.cs.st.evosuite.setup.TestTaskGenerator(TestTaskGene.java:57)
... 还有一个
原因:com.thoughtworks.xstream.converters.reflection.ObjectAccessException:无法构造de.unisb.cs.st.evosuite.callgraph.DistanceTransformer$ClassEnt ry,因为它没有无参数构造函数
位于com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProv ider.newInstance(PureJavaReflectionProvider.java:71)
位于com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.InstanceEnWinstance(AbstractReflectionConverter.java:308)
位于com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:161)
位于com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
... 还有19个
我不明白这一点,请任何人帮忙,我已经为此奋斗了很久。evosuite文档可在www.evosuite.org/documentation上找到。我认为这是一个内部evosuite错误,由于某种原因,是在cygwin中运行它造成的。您是否回答了自己的问题?或者试图为你的问题添加更多信息?如果是第二种情况,最好编辑您的原始问题或在原始帖子中添加评论。
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshall er.java:89)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(A bstractReferenceUnmarshaller.java:63)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm arshaller.java:76)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm arshaller.java:60)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionCon verter.readItem(AbstractCollectionConverter.java:71)
at com.thoughtworks.xstream.converters.collections.CollectionConverter.p opulateCollection(CollectionConverter.java:68)
at com.thoughtworks.xstream.converters.collections.CollectionConverter.u nmarshal(CollectionConverter.java:61)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshall er.java:82)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(A bstractReferenceUnmarshaller.java:63)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm arshaller.java:76)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm arshaller.java:60)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller .java:137)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarsh al(AbstractTreeMarshallingStrategy.java:33)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:923)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:909)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
at de.unisb.cs.st.evosuite.utils.Utils.readXML(Utils.java:301)
at de.unisb.cs.st.evosuite.callgraph.Hierarchy.readFromDefaultLocation(H ierarchy.java:113)
at de.unisb.cs.st.evosuite.setup.TestTaskGenerator.<clinit>(TestTaskGene rator.java:57)
... 1 more