@Test public void testEmptyMethodAndConstructors(){ Mockito.when(utility.getStackTraceMethods()).thenReturn(new ArrayList<>()); Mockito.when(utility.getStackTraceConstructors()).thenReturn(new ArrayList<>()); List<InputCoverageTestFitness> goals =inputCoverageFactory.getCoverageGoals(); assert (goals.isEmpty()); }
@Override public List<InputCoverageTestFitness> getCoverageGoals() { List<InputCoverageTestFitness> goals = new ArrayList<>(); List<Method> stackTraceMethods = utility.getStackTraceMethods(); List<Constructor> stackTraceConstructors = utility.getStackTraceConstructors(); for(Constructor constructor: stackTraceConstructors){ String className = constructor.getDeclaringClass().getName(); String methodName = "<init>"+Type.getConstructorDescriptor(constructor); Type[] argumentTypes = utility.getConstructorArgumentTypes(constructor); Class<?>[] argumentClasses = constructor.getParameterTypes(); LOG.info("Adding input goals for constructor " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } for(Method method: stackTraceMethods){ String className = method.getDeclaringClass().getName(); String methodName = method.getName()+Type.getMethodDescriptor(method); Type[] argumentTypes = Type.getArgumentTypes(method); Class<?>[] argumentClasses = method.getParameterTypes(); LOG.info("Adding input goals for method " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } return goals; }
InputCoverageFactory extends org.evosuite.coverage.io.input.InputCoverageFactory { @Override public List<InputCoverageTestFitness> getCoverageGoals() { List<InputCoverageTestFitness> goals = new ArrayList<>(); List<Method> stackTraceMethods = utility.getStackTraceMethods(); List<Constructor> stackTraceConstructors = utility.getStackTraceConstructors(); for(Constructor constructor: stackTraceConstructors){ String className = constructor.getDeclaringClass().getName(); String methodName = "<init>"+Type.getConstructorDescriptor(constructor); Type[] argumentTypes = utility.getConstructorArgumentTypes(constructor); Class<?>[] argumentClasses = constructor.getParameterTypes(); LOG.info("Adding input goals for constructor " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } for(Method method: stackTraceMethods){ String className = method.getDeclaringClass().getName(); String methodName = method.getName()+Type.getMethodDescriptor(method); Type[] argumentTypes = Type.getArgumentTypes(method); Class<?>[] argumentClasses = method.getParameterTypes(); LOG.info("Adding input goals for method " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } return goals; } }
InputCoverageFactory extends org.evosuite.coverage.io.input.InputCoverageFactory { @Override public List<InputCoverageTestFitness> getCoverageGoals() { List<InputCoverageTestFitness> goals = new ArrayList<>(); List<Method> stackTraceMethods = utility.getStackTraceMethods(); List<Constructor> stackTraceConstructors = utility.getStackTraceConstructors(); for(Constructor constructor: stackTraceConstructors){ String className = constructor.getDeclaringClass().getName(); String methodName = "<init>"+Type.getConstructorDescriptor(constructor); Type[] argumentTypes = utility.getConstructorArgumentTypes(constructor); Class<?>[] argumentClasses = constructor.getParameterTypes(); LOG.info("Adding input goals for constructor " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } for(Method method: stackTraceMethods){ String className = method.getDeclaringClass().getName(); String methodName = method.getName()+Type.getMethodDescriptor(method); Type[] argumentTypes = Type.getArgumentTypes(method); Class<?>[] argumentClasses = method.getParameterTypes(); LOG.info("Adding input goals for method " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } return goals; }  }
InputCoverageFactory extends org.evosuite.coverage.io.input.InputCoverageFactory { @Override public List<InputCoverageTestFitness> getCoverageGoals() { List<InputCoverageTestFitness> goals = new ArrayList<>(); List<Method> stackTraceMethods = utility.getStackTraceMethods(); List<Constructor> stackTraceConstructors = utility.getStackTraceConstructors(); for(Constructor constructor: stackTraceConstructors){ String className = constructor.getDeclaringClass().getName(); String methodName = "<init>"+Type.getConstructorDescriptor(constructor); Type[] argumentTypes = utility.getConstructorArgumentTypes(constructor); Class<?>[] argumentClasses = constructor.getParameterTypes(); LOG.info("Adding input goals for constructor " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } for(Method method: stackTraceMethods){ String className = method.getDeclaringClass().getName(); String methodName = method.getName()+Type.getMethodDescriptor(method); Type[] argumentTypes = Type.getArgumentTypes(method); Class<?>[] argumentClasses = method.getParameterTypes(); LOG.info("Adding input goals for method " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } return goals; }  @Override List<InputCoverageTestFitness> getCoverageGoals(); }
InputCoverageFactory extends org.evosuite.coverage.io.input.InputCoverageFactory { @Override public List<InputCoverageTestFitness> getCoverageGoals() { List<InputCoverageTestFitness> goals = new ArrayList<>(); List<Method> stackTraceMethods = utility.getStackTraceMethods(); List<Constructor> stackTraceConstructors = utility.getStackTraceConstructors(); for(Constructor constructor: stackTraceConstructors){ String className = constructor.getDeclaringClass().getName(); String methodName = "<init>"+Type.getConstructorDescriptor(constructor); Type[] argumentTypes = utility.getConstructorArgumentTypes(constructor); Class<?>[] argumentClasses = constructor.getParameterTypes(); LOG.info("Adding input goals for constructor " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } for(Method method: stackTraceMethods){ String className = method.getDeclaringClass().getName(); String methodName = method.getName()+Type.getMethodDescriptor(method); Type[] argumentTypes = Type.getArgumentTypes(method); Class<?>[] argumentClasses = method.getParameterTypes(); LOG.info("Adding input goals for method " + className + "." + methodName); detectGoals(className,methodName,argumentClasses,argumentTypes,goals); } return goals; }  @Override List<InputCoverageTestFitness> getCoverageGoals();  }