Search in sources :

Example 6 with AutomaticBuilder

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);
}
Also used : AutomaticBuilder(eu.stamp_project.dspot.common.automaticbuilder.AutomaticBuilder) UserInput(eu.stamp_project.dspot.common.configuration.UserInput) InitializeDSpot(eu.stamp_project.dspot.common.configuration.InitializeDSpot) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 7 with AutomaticBuilder

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());
}
Also used : AutomaticBuilder(eu.stamp_project.dspot.common.automaticbuilder.AutomaticBuilder) UserInput(eu.stamp_project.dspot.common.configuration.UserInput) Launcher(spoon.Launcher) InitializeDSpot(eu.stamp_project.dspot.common.configuration.InitializeDSpot) File(java.io.File) Test(org.junit.Test)

Aggregations

AutomaticBuilder (eu.stamp_project.dspot.common.automaticbuilder.AutomaticBuilder)7 InitializeDSpot (eu.stamp_project.dspot.common.configuration.InitializeDSpot)5 UserInput (eu.stamp_project.dspot.common.configuration.UserInput)4 File (java.io.File)3 Test (org.junit.Test)3 CtMethod (spoon.reflect.declaration.CtMethod)3 DSpotCompiler (eu.stamp_project.dspot.common.compilation.DSpotCompiler)2 GeneralMinimizer (eu.stamp_project.prettifier.minimization.GeneralMinimizer)1 PitMutantMinimizer (eu.stamp_project.prettifier.minimization.PitMutantMinimizer)1 ArrayList (java.util.ArrayList)1 BeforeClass (org.junit.BeforeClass)1 Launcher (spoon.Launcher)1 TypeFilter (spoon.reflect.visitor.filter.TypeFilter)1