use of eu.stamp_project.dspot.common.automaticbuilder.AutomaticBuilder in project dspot by STAMP-project.
the class AssertionGeneratorTest method setUpClass.
@BeforeClass
public static void setUpClass() {
configuration = new UserInput();
configuration.setAbsolutePathToProjectRoot(new File("src/test/resources/sample/").getAbsolutePath());
AutomaticBuilder builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
initializeDSpot = new InitializeDSpot();
dependencies = initializeDSpot.completeDependencies(configuration, builder);
}
use of eu.stamp_project.dspot.common.automaticbuilder.AutomaticBuilder in project dspot by STAMP-project.
the class AssertionRemoverTest method testOnDifferentKindOfAssertions.
@Test
public void testOnDifferentKindOfAssertions() throws Exception {
/*
Test that the AssertionRemover remove all kind of assertions
*/
UserInput configuration = new UserInput();
configuration.setAbsolutePathToProjectRoot(new File(getPathToProjectRoot()).getAbsolutePath());
// new TestCompiler(0,
// false,
// configuration.getAbsolutePathToProjectRoot(),
// configuration.getClasspathClassesProject(),
// 10000,
// "",
// false
//
// );
AutomaticBuilder builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
InitializeDSpot initializeDSpot = new InitializeDSpot();
String dependencies = initializeDSpot.completeDependencies(configuration, builder);
launcher = new Launcher();
launcher.addInputResource(getPathToProjectRoot());
launcher.getEnvironment().setOutputType(OutputType.CLASSES);
launcher.getModelBuilder().setSourceClasspath(dependencies.split(AmplificationHelper.PATH_SEPARATOR));
launcher.buildModel();
final CtClass<?> testClass = findClass("fr.inria.helper.TestWithMultipleAsserts");
final AssertionRemover assertionRemover = new AssertionRemover();
final CtMethod<?> testMethod = testClass.getMethodsByName("test").get(0);
final CtMethod<?> removedAssertion = assertionRemover.removeAssertions(testMethod, true);
assertEquals(4, removedAssertion.getBody().getStatements().size());
}
Aggregations