Assertions4

public class Assertions4(source)

The Assertions4 class provides methods for analyzing the source code of a student solution with Spoon. This includes utilities for checking for forbidden method calls, recursive method calls, and more.

Functions

Link copied to clipboard
public static void assertElementsNotUsed(CtMethod<? extends Object> method, Context context, Array<Matcher<CtElement>> elements)
Asserts that the given method does not use any of the given elements.
Link copied to clipboard
public static CtStatement assertHasElseStatement(CtIf ifStatement, Context context, PreCommentSupplier<? super Result<? extends Object, ? extends Object, ? extends Object, ? extends Object>> comment)
Asserts that the given CtIf statement has an else statement.
Link copied to clipboard
public static T assertIsCtElementOfType<T extends CtElement>(Class<T> expected, CtElement actual, Context context, PreCommentSupplier<? super ResultOfObject<Class<? extends CtElement>>> comment)
Asserts that the given CtElement is of the given type.
Link copied to clipboard
public static void assertIsNotIteratively(CtMethod<? extends Object> method, Context context, PreCommentSupplier<? super ResultOfFail> comment)
Asserts that the given method does not contain iterative statements.
Link copied to clipboard
public static void assertIsNotRecursively(CtMethod<? extends Object> method, Context context, PreCommentSupplier<? super ResultOfFail> comment)
Asserts that the given method does not contain recursive calls.
Link copied to clipboard
public static CtStatement assertIsOneStatement(CtStatement statement, Context context, PreCommentSupplier<? super ResultOfObject<CtStatement>> comment)
Asserts that the solution is one statement (containing only one semicolon).
Link copied to clipboard
public static void assertNotConditional(CtMethod<? extends Object> method, Context context)
Asserts that the given method does not contain conditional statements.
Link copied to clipboard
public static Array<Matcher<CtElement>> buildCtElementBlacklist(Array<Method> links)
Builds a list of Matchers for the given Methods.
public static Array<Matcher<CtElement>> buildCtElementBlacklist(Array<BasicMethodLink> links)
Builds a list of Matchers for the given BasicMethodLinks.