Package spoon.testing.utils
Class ModelUtils
java.lang.Object
spoon.testing.utils.ModelUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic Factory
Builds the Spoon mode of the `filesToBuild` given as parameterstatic Factory
Utility method for testing: creates the model of the given `classesToBuild` from src/test/java and returns the factorystatic <T extends CtType<?>>
TUtility method for testing: creates the model of `packageName` from src/test/java and returns the CtType corresponding to `className`static <T extends CtType<?>>
TUtility method for testing: creates the model of `packageName` and the factory from src/test/java and returns the CtType corresponding to `className`static Factory
Utility method for testing: creates the model of the given `classesToBuild` from src/test/java and returns the factory and allows to configure the Launcher first using `config`static <T> CtType<T>
buildClass(Class<T> classToBuild)
static <T> CtType<T>
buildClass(Class<T> classToBuild, boolean ensureFullclasspath)
Builds and returns the Spoon model of `` classToBuildstatic <T> CtType<T>
buildClass(Consumer<Launcher> config, Class<T> classToBuild)
static Factory
buildNoClasspath(Class<?>... classesToBuild)
Utility method for testing: creates the noclasspath model of the given `classesToBuild` from src/test/java and returns the factorystatic void
canBeBuilt(File outputDirectoryFile, int complianceLevel)
checks that the file `outputDirectoryFile` can be parsed with Spoon , given a compliance level.static void
canBeBuilt(File outputDirectoryFile, int complianceLevel, boolean noClasspath)
checks that the file `outputDirectoryFile` can be parsed with Spoon , given a compliance level and the noclasspath option.static void
canBeBuilt(String outputDirectory, int complianceLevel)
checks that the file at path `outputDirectory` can be parsed with Spoon , given a compliance level.static void
canBeBuilt(String outputDirectory, int complianceLevel, boolean noClasspath)
checks that the file at path `outputDirectory` can be parsed with Spoon , given a compliance level and noclasspath option.static Factory
static String
getOptimizedString(Object obj)
Converts `obj` to String and all EOLs and TABs are removed and sequences of white spaces are replaced by single space
-
Method Details
-
createFactory
-
build
Utility method for testing: creates the model of `packageName` from src/test/java and returns the CtType corresponding to `className`- Throws:
Exception
-
build
public static <T extends CtType<?>> T build(String packageName, String className, Factory f) throws ExceptionUtility method for testing: creates the model of `packageName` and the factory from src/test/java and returns the CtType corresponding to `className`- Throws:
Exception
-
build
Utility method for testing: creates the model of the given `classesToBuild` from src/test/java and returns the factory- Throws:
Exception
-
buildNoClasspath
Utility method for testing: creates the noclasspath model of the given `classesToBuild` from src/test/java and returns the factory- Throws:
Exception
-
build
public static Factory build(Consumer<Launcher> config, Class<?>... classesToBuild) throws ExceptionUtility method for testing: creates the model of the given `classesToBuild` from src/test/java and returns the factory and allows to configure the Launcher first using `config`- Throws:
Exception
-
build
Builds the Spoon mode of the `filesToBuild` given as parameter -
buildClass
- Throws:
Exception
-
buildClass
public static <T> CtType<T> buildClass(Class<T> classToBuild, boolean ensureFullclasspath) throws ExceptionBuilds and returns the Spoon model of `` classToBuild- Throws:
Exception
-
buildClass
public static <T> CtType<T> buildClass(Consumer<Launcher> config, Class<T> classToBuild) throws Exception- Throws:
Exception
-
canBeBuilt
checks that the file `outputDirectoryFile` can be parsed with Spoon , given a compliance level. -
canBeBuilt
checks that the file at path `outputDirectory` can be parsed with Spoon , given a compliance level. -
canBeBuilt
checks that the file `outputDirectoryFile` can be parsed with Spoon , given a compliance level and the noclasspath option. -
canBeBuilt
checks that the file at path `outputDirectory` can be parsed with Spoon , given a compliance level and noclasspath option. -
getOptimizedString
Converts `obj` to String and all EOLs and TABs are removed and sequences of white spaces are replaced by single space- Parameters:
obj
- to be converted object- Returns:
- single line string optimized for comparation
-