/** * Add a test call * * @return */ public void addTestCall(GenericAccessibleObject<?> call) throws IllegalArgumentException{ Inputs.checkNull(call); testMethods.add(call); }
@Deprecated // better (more precise results) to use the other constructor public MethodDescriptor(String className, String methodName, String inputParameterMatchers) throws IllegalArgumentException{ Inputs.checkNull(methodName,inputParameterMatchers); this.className = className; this.methodName = methodName; this.inputParameterMatchers = inputParameterMatchers; counter = 0; }
public static boolean canInstantiateOnlyOnce(Class<?> klass) throws IllegalArgumentException{ Inputs.checkNull(klass); for(Class<?> c : classes) { if(c.isAssignableFrom(klass)){ return true; } } return false; } }
public void accessedHttpRequestParameter(String param) throws IllegalArgumentException{ Inputs.checkNull(param); httpRequestParameters.add(param); } }
public GenericMethod(Method method, Type type) { super(new GenericClass(type)); this.method = method; Inputs.checkNull(method, type); }
public static List<TestChromosome> loadTests(File folder, String fileName) throws IllegalArgumentException { Inputs.checkNull(folder, fileName); File target = new File(folder,fileName); return loadTests(target); }
public GenericMethod(Method method, GenericClass type) { super(new GenericClass(type)); this.method = method; Inputs.checkNull(method, type); }
public static List<File> getRecursivelyAllFilesInAllSubfolders(File folder, String suffix) throws IllegalArgumentException{ Inputs.checkNull(folder, suffix); List<File> buffer = new ArrayList<>(); _recursiveAllFiles(folder, suffix, buffer); return buffer; }
/** * Scan the <code>base</code> folder, and return a list of all files with the given name <code>ending</code> * * @param base * @param suffix * @return */ public static List<File> getRecursivelyAllFilesInAllSubfolders(String base, String suffix) throws IllegalArgumentException{ Inputs.checkNull(base, suffix); return getRecursivelyAllFilesInAllSubfolders(new File(base), suffix); }
public FunctionalMockStatement(TestCase tc, VariableReference retval, GenericClass targetClass) throws IllegalArgumentException { super(tc, retval); Inputs.checkNull(targetClass); this.targetClass = targetClass; mockedMethods = new ArrayList<>(); methodParameters = new LinkedHashMap<>(); checkTarget(); assert parameters.isEmpty(); //setUpMockCreator(); }
public Type[] map(Type[] types) throws IllegalArgumentException{ Inputs.checkNull(types); Type[] result = new Type[types.length]; for (int i = 0; i < types.length; i++) { result[i] = map(types[i]); } return result; } }
public static boolean saveTests(List<TestSuiteChromosome> ts, File folder, String fileName) throws IllegalArgumentException{ Inputs.checkNull(ts,folder,fileName); if(!folder.exists()){ folder.mkdirs(); } File target = new File(folder,fileName); return saveTests(ts,target); }
/** * * @param method the one that is going to be mocked * @param retvalType type of the class the mocked method belongs to. The type might be parameterized (ie generics) */ public MethodDescriptor(Method method, GenericClass retvalType){ Inputs.checkNull(method, retvalType); this.method = new GenericMethod(method, retvalType); methodName = method.getName(); className = method.getDeclaringClass().getName(); inputParameterMatchers = initMatchers(this.method, retvalType); }
public void addAll(Map<TypeVariable<?>, GenericClass> variables) throws IllegalArgumentException{ Inputs.checkNull(variables); for (Entry<TypeVariable<?>, GenericClass> entry : variables.entrySet()) { add(entry.getKey(), entry.getValue().getType()); } }
public Field getField(Class<?> klass) throws IllegalArgumentException { Inputs.checkNull(klass); if(!hasField(klass)) { return null; } // it should never return null Field field = ReflectionUtils.getDeclaredField(klass, cache.get(klass.getName())); assert field != null; return field; }
@EvoSuiteExclude public static boolean hasEvent( Class<?> klass) throws IllegalArgumentException { Inputs.checkNull(klass); return eventCache.hasField(klass); }
public void addNewDependencies(Collection<Class<?>> rawTypes) { Inputs.checkNull(rawTypes); Set<String> blackList = new LinkedHashSet<>(); initBlackListWithEvoSuitePrimitives(blackList); rawTypes.stream().forEach(c -> dependencies.add(new DependencyPair(0, new GenericClass(c).getRawClass()))); resolveDependencies(blackList); }
@Constraints(noNullInputs = true, notMutable = true, noDirectInsertion = true) public static <T> void injectUserTransaction(@BoundInputVariable(initializer = true, atMostOnceWithSameParameters = true) T instance, Class<?> clazz) throws IllegalArgumentException { Inputs.checkNull(instance,clazz); String field = userTransactionCache.getFieldName(clazz); assert field != null; inject(instance, clazz, field, new EvoUserTransaction()); //TODO this will likely need to change in the future }
@Constraints(noNullInputs = true, notMutable = true, noDirectInsertion = true) public static <T> void injectEntityManager(@BoundInputVariable(initializer = true, atMostOnceWithSameParameters = true) T instance, Class<?> clazz) throws IllegalArgumentException{ Inputs.checkNull(instance,clazz); String field = entityManagerCache.getFieldName(clazz); assert field != null; inject(instance, clazz, field, DBManager.getInstance().getCurrentEntityManager()); }
@Test public void test2() throws Throwable { try { Inputs.checkNull((Object[]) null); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // No inputs to check // assertThrownBy("org.evosuite.runtime.util.Inputs", e); } }