From fe7955f04f631728468e90c5f4a8a6f30fd7dc0b Mon Sep 17 00:00:00 2001 From: Benjamin DANGLOT Date: Wed, 6 Feb 2019 00:06:48 +0100 Subject: [PATCH] Feat: remove redundant cast FIX #688 (#693) * refactor: rename post_dspot package to prettifier * feat: remove redundant casts * pom: rename DSpot to DSpot Core * ci: add now a travis job for dspot-pretiffier * test: remove test resources that are unused * test: add the sample properties --- .travis.yml | 5 +- .travis/travis-prettifier.sh | 5 ++ .../prettifier/RedundantCastRemover.java | 59 ++++++++++++++ .../code2vec/builder/Cloner.java | 2 +- .../code2vec/builder/Main.java | 2 +- .../builder/NumbersOfMethodsPerSet.java | 2 +- .../code2vec/builder/Output.java | 2 +- .../code2vec/builder/Reader.java | 2 +- .../code2vec/builder/Report.java | 2 +- .../builder/TestMethodsExtractor.java | 2 +- .../minimization/ChangeMinimizer.java | 5 +- .../minimization/GeneralMinimizer.java | 2 +- .../minimization/Minimizer.java | 2 +- .../minimization/PitMutantMinimizer.java | 2 +- .../prettifier/RedundantCastRemoverTest.java | 54 +++++++++++++ .../minimization/ChangeMinimizerTest.java | 2 +- .../minimization/GeneralMinimizerTest.java | 2 +- .../resources/AmplifiedTest.java | 68 ++++++++++++++++ .../resources/sample/.dspot__junit5_pom.xml | 77 ------------------- .../test/resources/sample/sample.properties | 11 +++ .../fr/inria/amp/ClassWithMethodCall.java | 20 ----- .../src/main/java/fr/inria/amp/JavaPoet.java | 28 ------- .../java/fr/inria/amp/LiteralMutation.java | 61 --------------- .../src/main/java/fr/inria/infinite/Loop.java | 13 ---- .../inria/inheritance/InheritanceSource.java | 13 ---- .../lombok/LombokClassThatUseBuilder.java | 29 ------- .../multipleobservations/ClassToBeTest.java | 26 ------- .../fr/inria/mutation/ClassUnderTest.java | 22 ------ .../java/fr/inria/overflow/Matriochka.java | 6 -- .../java/fr/inria/overflow/SubMatriochka.java | 9 --- .../inria/removebadtest/ClassToBeTested.java | 18 ----- .../fr/inria/sample/ClassThrowException.java | 13 ---- .../fr/inria/sample/ClassWithBoolean.java | 73 ------------------ .../fr/inria/sample/ClassWithFieldRead.java | 26 ------- .../java/fr/inria/sample/ClassWithMap.java | 35 --------- .../statementadd/ClassParameterAmplify.java | 34 -------- .../fr/inria/statementadd/ClassTarget.java | 39 ---------- .../statementadd/ClassTargetAmplify.java | 28 ------- .../ClassParameterAmplify.java | 26 ------- .../statementaddarray/ClassTargetAmplify.java | 24 ------ .../inria/testrunner/ClassWithVisibility.java | 46 ----------- .../java/fr/inria/amp/OneLiteralTest.java | 16 ---- .../test/java/fr/inria/amp/TestJavaPoet.java | 35 --------- .../inria/amp/ToBeAmplifiedLiteralTest.java | 16 ---- ...AmplifiedTestClassWithReferenceToName.java | 19 ----- .../TestClassWithAssertToBeRemoved.java | 40 ---------- .../java/fr/inria/factory/FactoryTest.java | 36 --------- .../fr/inria/filter/failing/FailingTest.java | 38 --------- .../fr/inria/filter/passing/PassingTest.java | 30 -------- .../java/fr/inria/helper/ClassJunit3.java | 17 ---- .../fr/inria/helper/ClassWithInnerClass.java | 65 ---------------- .../fr/inria/helper/GoogleTruthTestClass.java | 24 ------ .../fr/inria/helper/SecondClassJUnit3.java | 30 -------- .../fr/inria/helper/SubClassOfJUnit3.java | 14 ---- .../inria/helper/TestWithMultipleAsserts.java | 40 ---------- .../test/java/fr/inria/infinite/LoopTest.java | 12 --- .../java/fr/inria/inheritance/Inherit.java | 9 --- .../java/fr/inria/inheritance/Inherit2.java | 18 ----- .../java/fr/inria/inheritance/Inherited.java | 22 ------ .../lombok/LombokClassThatUseBuilderTest.java | 16 ---- .../TestClassToBeTest.java | 17 ---- .../fr/inria/mutation/ClassUnderTestTest.java | 33 -------- .../preparation/MustBeRenamedFromStart.java | 30 -------- .../removebadtest/TestClassToBeTested.java | 40 ---------- .../fr/inria/sample/TestClassWithAssert.java | 74 ------------------ .../inria/sample/TestClassWithAssertOld.java | 20 ----- .../inria/sample/TestClassWithFieldRead.java | 16 ---- .../fr/inria/sample/TestClassWithLiteral.java | 9 --- .../fr/inria/sample/TestClassWithLoop.java | 59 -------------- ...TestClassWithSpecificCaseToBeAsserted.java | 24 ------ .../inria/sample/TestClassWithoutAssert.java | 47 ----------- .../sample/TestClassWithoutAssertJUnit5.java | 48 ------------ .../inria/statementadd/TestClassTarget.java | 28 ------- .../statementadd/TestClassTargetAmplify.java | 16 ---- .../TestClassTargetAmplify.java | 16 ---- .../SystemPropertiesTest.java | 21 ----- .../testframework/TestSupportJUnit3.java | 15 ---- .../testframework/TestSupportJUnit4.java | 18 ----- .../testframework/TestSupportJUnit5.java | 36 --------- .../fr/inria/testresources/TestResources.java | 14 ---- .../testrunner/TestClassWithVisibility.java | 25 ------ .../java/fr/inria/workload/WorkloadTest.java | 36 --------- .../sample/src/test/resources/aResource | 1 - .../aResourcesDirectory/anotherResource | 1 - dspot/pom.xml | 2 +- 85 files changed, 214 insertions(+), 1826 deletions(-) create mode 100755 .travis/travis-prettifier.sh create mode 100644 dspot-prettifier/src/main/java/eu/stamp_project/prettifier/RedundantCastRemover.java rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/code2vec/builder/Cloner.java (98%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/code2vec/builder/Main.java (97%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/code2vec/builder/NumbersOfMethodsPerSet.java (96%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/code2vec/builder/Output.java (98%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/code2vec/builder/Reader.java (94%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/code2vec/builder/Report.java (99%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/code2vec/builder/TestMethodsExtractor.java (98%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/minimization/ChangeMinimizer.java (97%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/minimization/GeneralMinimizer.java (99%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/minimization/Minimizer.java (89%) rename dspot-prettifier/src/main/java/eu/stamp_project/{post_dspot => prettifier}/minimization/PitMutantMinimizer.java (99%) create mode 100644 dspot-prettifier/src/test/java/eu/stamp_project/prettifier/RedundantCastRemoverTest.java rename dspot-prettifier/src/test/java/eu/stamp_project/{post_dspot => prettifier}/minimization/ChangeMinimizerTest.java (98%) rename dspot-prettifier/src/test/java/eu/stamp_project/{post_dspot => prettifier}/minimization/GeneralMinimizerTest.java (98%) create mode 100644 dspot-prettifier/src/test/java/eu/stamp_project/resources/AmplifiedTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/.dspot__junit5_pom.xml create mode 100644 dspot-prettifier/src/test/resources/sample/sample.properties delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/ClassWithMethodCall.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/JavaPoet.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/LiteralMutation.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/infinite/Loop.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/inheritance/InheritanceSource.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/lombok/LombokClassThatUseBuilder.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/multipleobservations/ClassToBeTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/mutation/ClassUnderTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/overflow/Matriochka.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/overflow/SubMatriochka.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/removebadtest/ClassToBeTested.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassThrowException.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithBoolean.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithFieldRead.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithMap.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassParameterAmplify.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassTarget.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassTargetAmplify.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementaddarray/ClassParameterAmplify.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementaddarray/ClassTargetAmplify.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/testrunner/ClassWithVisibility.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/OneLiteralTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/TestJavaPoet.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/ToBeAmplifiedLiteralTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amplified/AmplifiedTestClassWithReferenceToName.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/assertionremover/TestClassWithAssertToBeRemoved.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/factory/FactoryTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/filter/failing/FailingTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/filter/passing/PassingTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/ClassJunit3.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/ClassWithInnerClass.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/GoogleTruthTestClass.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/SecondClassJUnit3.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/SubClassOfJUnit3.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/TestWithMultipleAsserts.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/infinite/LoopTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherit.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherit2.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherited.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/lombok/LombokClassThatUseBuilderTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/multipleobservations/TestClassToBeTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/mutation/ClassUnderTestTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/preparation/MustBeRenamedFromStart.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/removebadtest/TestClassToBeTested.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithAssert.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithAssertOld.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithFieldRead.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithLiteral.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithLoop.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithSpecificCaseToBeAsserted.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithoutAssert.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithoutAssertJUnit5.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementadd/TestClassTarget.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementadd/TestClassTargetAmplify.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementaddarray/TestClassTargetAmplify.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/systemproperties/SystemPropertiesTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit3.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit4.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit5.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testresources/TestResources.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testrunner/TestClassWithVisibility.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/workload/WorkloadTest.java delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/resources/aResource delete mode 100644 dspot-prettifier/src/test/resources/sample/src/test/resources/aResourcesDirectory/anotherResource diff --git a/.travis.yml b/.travis.yml index f7b2504f3..5716ee2a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,8 @@ env: - SCRIPT=travis-dhell.sh - SCRIPT=travis-ci-xwiki.sh - SCRIPT=travis-diff-test-selection.sh -# - SCRIPT=travis-dspot-maven-cmd-line.sh + - SCRIPT=travis-prettifier.sh +# - SCRIPT=travis-dspot-maven-cmd-line.sh TODO FIXME cache: directories: @@ -40,4 +41,4 @@ after_success: branch: only: - - master \ No newline at end of file + - master diff --git a/.travis/travis-prettifier.sh b/.travis/travis-prettifier.sh new file mode 100755 index 000000000..79c43bf92 --- /dev/null +++ b/.travis/travis-prettifier.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +source /opt/jdk_switcher/jdk_switcher.sh + +jdk_switcher use openjdk8 & mvn -Djava.src.version=1.8 test -f dspot-prettifier/pom.xml diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/RedundantCastRemover.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/RedundantCastRemover.java new file mode 100644 index 000000000..c5b5e6799 --- /dev/null +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/RedundantCastRemover.java @@ -0,0 +1,59 @@ +package eu.stamp_project.prettifier; + +import eu.stamp_project.test_framework.TestFramework; +import spoon.reflect.code.CtExpression; +import spoon.reflect.code.CtInvocation; +import spoon.reflect.declaration.CtMethod; +import spoon.reflect.reference.CtTypeReference; + +import java.util.List; + +/** + * created by Benjamin DANGLOT + * benjamin.danglot@inria.fr + * on 04/02/19 + */ +public class RedundantCastRemover { + + + public CtMethod remove(CtMethod testMethod) { + final List> assertions = testMethod.getElements(TestFramework.ASSERTIONS_FILTER); + for (CtInvocation assertion : assertions) { + this.remove(assertion); + } + return testMethod; + } + + private void remove(CtInvocation assertion) { + final CtExpression actualValue = assertion.getArguments().get(assertion.getArguments().size() - 1); + final CtExpression expectedValue = assertion.getArguments().get(assertion.getArguments().size() - 2); + // top cast compared to the expected value + if (!actualValue.getTypeCasts().isEmpty() && + actualValue.getTypeCasts().get(0).equals(expectedValue.getType())) { + actualValue.getTypeCasts().remove(0); + } + // inner casts that can be removed + removeCastInvocations(actualValue); + } + + private void removeCastInvocations(CtExpression current) { + while (current instanceof CtInvocation) { + current = ((CtInvocation) current).getTarget(); + if (!current.getTypeCasts().isEmpty() && + matchTypes(current.getTypeCasts().get(0), current.getType())) { + current.getTypeCasts().remove(0); + } + } + } + + private boolean matchTypes(CtTypeReference toBeMatched, CtTypeReference type) { + if (type == null) { + return false; + } else if (toBeMatched.equals(type)) { + return true; + } else { + return matchTypes(toBeMatched, type.getSuperclass()); + } + } + +} diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Cloner.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Cloner.java similarity index 98% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Cloner.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Cloner.java index c8d0dbe59..cc8f3d158 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Cloner.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Cloner.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.code2vec.builder; +package eu.stamp_project.prettifier.code2vec.builder; import eu.stamp_project.utils.AmplificationHelper; import org.apache.commons.io.FileUtils; diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Main.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Main.java similarity index 97% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Main.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Main.java index 8510fed7e..b3fccaab8 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Main.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Main.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.code2vec.builder; +package eu.stamp_project.prettifier.code2vec.builder; import eu.stamp_project.utils.DSpotUtils; import org.slf4j.Logger; diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/NumbersOfMethodsPerSet.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/NumbersOfMethodsPerSet.java similarity index 96% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/NumbersOfMethodsPerSet.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/NumbersOfMethodsPerSet.java index f3df88fdf..cad775f67 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/NumbersOfMethodsPerSet.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/NumbersOfMethodsPerSet.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.code2vec.builder; +package eu.stamp_project.prettifier.code2vec.builder; public class NumbersOfMethodsPerSet { diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Output.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Output.java similarity index 98% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Output.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Output.java index 318e05579..84e32b336 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Output.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Output.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.code2vec.builder; +package eu.stamp_project.prettifier.code2vec.builder; import spoon.compiler.Environment; import spoon.reflect.declaration.CtType; diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Reader.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Reader.java similarity index 94% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Reader.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Reader.java index 1d12697b4..b61e4047b 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Reader.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Reader.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.code2vec.builder; +package eu.stamp_project.prettifier.code2vec.builder; import java.io.BufferedReader; import java.io.FileReader; diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Report.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Report.java similarity index 99% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Report.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Report.java index 0a0bc528c..324fc9a8a 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/Report.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/Report.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.code2vec.builder; +package eu.stamp_project.prettifier.code2vec.builder; import eu.stamp_project.utils.AmplificationHelper; diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/TestMethodsExtractor.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/TestMethodsExtractor.java similarity index 98% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/TestMethodsExtractor.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/TestMethodsExtractor.java index dd3758657..2d4b95fc2 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/code2vec/builder/TestMethodsExtractor.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/code2vec/builder/TestMethodsExtractor.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.code2vec.builder; +package eu.stamp_project.prettifier.code2vec.builder; import eu.stamp_project.test_framework.TestFramework; import org.slf4j.Logger; diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/ChangeMinimizer.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/ChangeMinimizer.java similarity index 97% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/ChangeMinimizer.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/ChangeMinimizer.java index 29004f11c..695460975 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/ChangeMinimizer.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/ChangeMinimizer.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.minimization; +package eu.stamp_project.prettifier.minimization; import eu.stamp_project.minimization.GeneralMinimizer; import eu.stamp_project.test_framework.TestFramework; @@ -15,10 +15,7 @@ import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtType; -import javax.swing.plaf.nimbus.State; import java.io.File; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.TimeoutException; diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/GeneralMinimizer.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/GeneralMinimizer.java similarity index 99% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/GeneralMinimizer.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/GeneralMinimizer.java index d41662518..990fdbef3 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/GeneralMinimizer.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/GeneralMinimizer.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.minimization; +package eu.stamp_project.prettifier.minimization; import eu.stamp_project.minimization.Minimizer; import eu.stamp_project.test_framework.TestFramework; diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/Minimizer.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/Minimizer.java similarity index 89% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/Minimizer.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/Minimizer.java index eec74e5f5..da5408f19 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/Minimizer.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/Minimizer.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.minimization; +package eu.stamp_project.prettifier.minimization; import spoon.reflect.declaration.CtMethod; diff --git a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/PitMutantMinimizer.java b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/PitMutantMinimizer.java similarity index 99% rename from dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/PitMutantMinimizer.java rename to dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/PitMutantMinimizer.java index 78f5bcdba..95f53881f 100644 --- a/dspot-prettifier/src/main/java/eu/stamp_project/post_dspot/minimization/PitMutantMinimizer.java +++ b/dspot-prettifier/src/main/java/eu/stamp_project/prettifier/minimization/PitMutantMinimizer.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.minimization; +package eu.stamp_project.prettifier.minimization; import eu.stamp_project.minimization.GeneralMinimizer; import eu.stamp_project.utils.pit.AbstractPitResult; diff --git a/dspot-prettifier/src/test/java/eu/stamp_project/prettifier/RedundantCastRemoverTest.java b/dspot-prettifier/src/test/java/eu/stamp_project/prettifier/RedundantCastRemoverTest.java new file mode 100644 index 000000000..cf66f7f03 --- /dev/null +++ b/dspot-prettifier/src/test/java/eu/stamp_project/prettifier/RedundantCastRemoverTest.java @@ -0,0 +1,54 @@ +package eu.stamp_project.prettifier; + +import org.junit.Test; +import spoon.Launcher; +import spoon.reflect.declaration.CtMethod; +import spoon.reflect.factory.Factory; + +import static org.junit.Assert.assertEquals; + +/** + * created by Benjamin DANGLOT + * benjamin.danglot@inria.fr + * on 04/02/19 + */ +public class RedundantCastRemoverTest { + + @Test + public void test() { + + /* + This test that we can remove some redundant cast. + + The last statement should keeps its cast + */ + + Launcher launcher = new Launcher(); + launcher.addInputResource("src/test/java/eu/stamp_project/resources/AmplifiedTest.java"); + launcher.buildModel(); + + final Factory factory = launcher.getFactory(); + final CtMethod redundantCast = factory.Class().get("eu.stamp_project.resources.AmplifiedTest") + .getMethodsByName("redundantCast").get(0); + + final RedundantCastRemover redundantCastRemover = new RedundantCastRemover(); + final CtMethod amplifiedTestWithoutRedundantCast = redundantCastRemover.remove(redundantCast); + assertEquals(expected, + amplifiedTestWithoutRedundantCast.getBody().toString() + ); + } + + private static final String expected = "{\n" + + " final eu.stamp_project.resources.AmplifiedTest amplifiedTest = new eu.stamp_project.resources.AmplifiedTest();\n" + + " final eu.stamp_project.resources.AmplifiedTest.MyObject myObject = new eu.stamp_project.resources.AmplifiedTest.MyObject();\n" + + " // should be removed\n" + + " org.junit.Assert.assertEquals(0, amplifiedTest.getInt());\n" + + " org.junit.Assert.assertEquals(0, amplifiedTest.getInt());\n" + + " org.junit.Assert.assertEquals(0, myObject.getInt());\n" + + " org.junit.Assert.assertEquals(0, myObject.getMyInternalObject().getInt());\n" + + " org.junit.Assert.assertEquals(0, myObject.getMyInternalObject().getMySecondIntegernalObject().getInt());\n" + + " org.junit.Assert.assertEquals(0, myObject.getMyInternalObject().getMySecondIntegernalObject().getInt());\n" + + " // should not be removed\n" + + " org.junit.Assert.assertEquals(0, ((eu.stamp_project.resources.AmplifiedTest.MySecondInternalObject) (myObject.getMyInternalObject().getMySecondIntegernalObject().getObject())).getSecondInt());\n" + + "}"; +} diff --git a/dspot-prettifier/src/test/java/eu/stamp_project/post_dspot/minimization/ChangeMinimizerTest.java b/dspot-prettifier/src/test/java/eu/stamp_project/prettifier/minimization/ChangeMinimizerTest.java similarity index 98% rename from dspot-prettifier/src/test/java/eu/stamp_project/post_dspot/minimization/ChangeMinimizerTest.java rename to dspot-prettifier/src/test/java/eu/stamp_project/prettifier/minimization/ChangeMinimizerTest.java index 8263c27ca..b7d13045c 100644 --- a/dspot-prettifier/src/test/java/eu/stamp_project/post_dspot/minimization/ChangeMinimizerTest.java +++ b/dspot-prettifier/src/test/java/eu/stamp_project/prettifier/minimization/ChangeMinimizerTest.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.minimization; +package eu.stamp_project.prettifier.minimization; import eu.stamp_project.AbstractTest; import eu.stamp_project.Utils; diff --git a/dspot-prettifier/src/test/java/eu/stamp_project/post_dspot/minimization/GeneralMinimizerTest.java b/dspot-prettifier/src/test/java/eu/stamp_project/prettifier/minimization/GeneralMinimizerTest.java similarity index 98% rename from dspot-prettifier/src/test/java/eu/stamp_project/post_dspot/minimization/GeneralMinimizerTest.java rename to dspot-prettifier/src/test/java/eu/stamp_project/prettifier/minimization/GeneralMinimizerTest.java index 6662cbd86..957b2f310 100644 --- a/dspot-prettifier/src/test/java/eu/stamp_project/post_dspot/minimization/GeneralMinimizerTest.java +++ b/dspot-prettifier/src/test/java/eu/stamp_project/prettifier/minimization/GeneralMinimizerTest.java @@ -1,4 +1,4 @@ -package eu.stamp_project.post_dspot.minimization; +package eu.stamp_project.prettifier.minimization; import eu.stamp_project.AbstractTest; import eu.stamp_project.Utils; diff --git a/dspot-prettifier/src/test/java/eu/stamp_project/resources/AmplifiedTest.java b/dspot-prettifier/src/test/java/eu/stamp_project/resources/AmplifiedTest.java new file mode 100644 index 000000000..dc95bc37c --- /dev/null +++ b/dspot-prettifier/src/test/java/eu/stamp_project/resources/AmplifiedTest.java @@ -0,0 +1,68 @@ +package eu.stamp_project.resources; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * created by Benjamin DANGLOT + * benjamin.danglot@inria.fr + * on 04/02/19 + */ +public class AmplifiedTest { + + public class MyObject { + public MyInternalObject getMyInternalObject() { + return new MyInternalObject(); + } + + public int getInt() { + return 0; + } + } + + public class MyInternalObject { + public int getInt() { + return 0; + } + + public MySecondInternalObject getMySecondIntegernalObject() { + return new MySecondInternalObject(); + } + } + + public class MySecondInternalObject extends MyObject { + public MyObject getObject() { + return this; + } + + public int getSecondInt() { + return 0; + } + } + + public int getInt() { + return 0; + } + + public Integer getInteger() { + return 0; + } + + @Test + public void redundantCast() { + final AmplifiedTest amplifiedTest = new AmplifiedTest(); + final MyObject myObject = new MyObject(); + + // should be removed + assertEquals(0, (int) ((AmplifiedTest) amplifiedTest).getInt()); + assertEquals(0, (int) amplifiedTest.getInt()); + assertEquals(0, (int) ((MyObject) myObject).getInt()); + assertEquals(0, (int) ((MyInternalObject) ((MyObject) myObject).getMyInternalObject()).getInt()); + assertEquals(0, (int) ((MySecondInternalObject) ((MyInternalObject) ((MyObject) myObject).getMyInternalObject()).getMySecondIntegernalObject()).getInt()); + assertEquals(0, (int) ((MyObject) ((MyInternalObject) ((MyObject) myObject).getMyInternalObject()).getMySecondIntegernalObject()).getInt()); + + // should not be removed + assertEquals(0, ((MySecondInternalObject) myObject.getMyInternalObject().getMySecondIntegernalObject().getObject()).getSecondInt()); + } +} diff --git a/dspot-prettifier/src/test/resources/sample/.dspot__junit5_pom.xml b/dspot-prettifier/src/test/resources/sample/.dspot__junit5_pom.xml deleted file mode 100644 index 7373f77e0..000000000 --- a/dspot-prettifier/src/test/resources/sample/.dspot__junit5_pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - 4.0.0 - - fr.inria - sample - 1.0 - - - UTF-8 - UTF-8 - 1.8 - 1.8 - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.20 - - - - admin - toto - - - passwd - tata - - - - - - - - - - junit - junit - 4.12 - - - com.google.truth - truth - 0.28 - test - - - org.junit.jupiter - junit-jupiter-api - 5.1.0 - test - - - org.assertj - assertj-core - 1.7.1 - - - - - org.projectlombok - lombok - 1.18.4 - provided - - - - - - - test-resources - - id-descartes-for-dspotorg.pitestpitest-maven1.4.0gregorCSVfr.inria.sample.*target/pit-reports10000-Xmx2048m-Xms1024m-Dis.admin.user=admin-Dis.admin.passwd=$2pRSid#fr.inria.filter.failing.*ALLorg.pitestpitest-junit5-plugin0.7 - - \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/sample.properties b/dspot-prettifier/src/test/resources/sample/sample.properties new file mode 100644 index 000000000..8ccddcbc2 --- /dev/null +++ b/dspot-prettifier/src/test/resources/sample/sample.properties @@ -0,0 +1,11 @@ +project=src/test/resources/sample/ +src=src/main/java +testSrc=src/test/java +testResources=src/test/resources +outputDirectory=target/trash/ +filter=fr.inria.sample.* +systemProperties=admin=toto,passwd=tata +excludedClasses=fr.inria.filter.failing.* +excludedTestCases=failingTestCase +jvmArgs=-Xmx2048m,-Xms1024m,-Dis.admin.user=admin,-Dis.admin.passwd=$2pRSid# +pitVersion=1.4.0 \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/ClassWithMethodCall.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/ClassWithMethodCall.java deleted file mode 100644 index f17fbd347..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/ClassWithMethodCall.java +++ /dev/null @@ -1,20 +0,0 @@ -package fr.inria.amp; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 14/08/18 - */ -public class ClassWithMethodCall { - - public void method(Integer a, int b) { - // empty - } - - public void methodCall() { - Integer i = 1; - int z = 1; - this.method(1, 1); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/JavaPoet.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/JavaPoet.java deleted file mode 100644 index 5df7f69f3..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/JavaPoet.java +++ /dev/null @@ -1,28 +0,0 @@ -package fr.inria.amp; - -public class JavaPoet { - - public String method() throws Exception { - return "" - + "package com.squareup.tacos;\n" - + "\n" - + "class A {\n" - + " class B {\n" - + " class C {\n" - + " Twin.D d;\n" - + "\n" - + " class Nested {\n" - + " class Twin {\n" - + " }\n" - + " }\n" - + " }\n" - + " }\n" - + "\n" - + " class Twin {\n" - + " class D {\n" - + " }\n" - + " }\n" - + "}\n"; - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/LiteralMutation.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/LiteralMutation.java deleted file mode 100644 index 680a9e817..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/amp/LiteralMutation.java +++ /dev/null @@ -1,61 +0,0 @@ -package fr.inria.amp; - -public class LiteralMutation { - - int presentLitInt = 32; - double presentLitDouble = 32D; - String presentLitString = "MySecondStringLiteral"; - - public void methodByte() { - byte literalByte = (byte)23; - } - - public void methodShort() { - short literalShort = (short)23; - } - - public void methodInteger() { - int literalInt = 23; - } - - public void methodLong() { - long literalLong = 23L; - } - - public void methodFloat() { - float literalFloat = 23F; - } - - public void methodDouble() { - double literalDouble = 23D; - } - - public void methodString() { - String literalString = "MyStringLiteral"; - literalString = null; - String literalString2 = null; - literalString = getString("MyStringLiteral3"); - literalString = getString(null); - } - - private String getString(String s) { - return s; - } - - public void methodBoolean() { - boolean literalBoolean = true; - } - - public void methodCharacter() { - char character = 'z'; - } - - public void methodWithCharArray(char... array) { - - } - - public void methodThatClassmethodWithCharArray() { - methodWithCharArray('a', 'b'); - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/infinite/Loop.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/infinite/Loop.java deleted file mode 100644 index a3b67ba67..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/infinite/Loop.java +++ /dev/null @@ -1,13 +0,0 @@ -package fr.inria.infinite; - -public class Loop { - - public boolean loop = true; - - public void infinite() { - while (loop) { - // do nothing - } - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/inheritance/InheritanceSource.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/inheritance/InheritanceSource.java deleted file mode 100644 index 4a115710b..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/inheritance/InheritanceSource.java +++ /dev/null @@ -1,13 +0,0 @@ -package fr.inria.inheritance; - -public class InheritanceSource { - - public int method(int a) { - if (a == 0) { - return 1; - } else { - return 0; - } - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/lombok/LombokClassThatUseBuilder.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/lombok/LombokClassThatUseBuilder.java deleted file mode 100644 index 17b549413..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/lombok/LombokClassThatUseBuilder.java +++ /dev/null @@ -1,29 +0,0 @@ -package fr.inria.lombok; - -import lombok.Builder; -import lombok.Data; - -import java.util.List; - -/** - * created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 06/12/18 - * - * This class is a copy from catalog of Activeeon. - * See org.ow2.proactive.catalog.service.model.AuthenticatedUser - * - * @author ActiveEon Team - * @since 27/07/2017 - */ -@Builder -@Data -public class LombokClassThatUseBuilder { - - public final static LombokClassThatUseBuilder EMPTY = LombokClassThatUseBuilder.builder().build(); - - private String name; - - private List groups; - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/multipleobservations/ClassToBeTest.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/multipleobservations/ClassToBeTest.java deleted file mode 100644 index 856ec2577..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/multipleobservations/ClassToBeTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package fr.inria.multipleobservations; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 04/10/17 - */ -public class ClassToBeTest { - - private int i = 0; - - private Integer I = 0; - - public void method() { - i++; - I++; - } - - public int getInt() { - return i; - } - - public Integer getInteger() { - return I; - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/mutation/ClassUnderTest.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/mutation/ClassUnderTest.java deleted file mode 100644 index a1a8168f6..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/mutation/ClassUnderTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package fr.inria.mutation; - -public class ClassUnderTest { - - public ClassUnderTest() { - - } - - public int plusOne(int integer) { - return integer + 1; - } - - /* not tested in ClassUnderTestTest */ - public int minusOne(int integer) { - return integer - 1; - } - - public boolean getBoolean() { - return true; - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/overflow/Matriochka.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/overflow/Matriochka.java deleted file mode 100644 index 7f2fb3630..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/overflow/Matriochka.java +++ /dev/null @@ -1,6 +0,0 @@ -package fr.inria.overflow; - -public class Matriochka extends SubMatriochka { - public void aMethod() { - } - } \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/overflow/SubMatriochka.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/overflow/SubMatriochka.java deleted file mode 100644 index f1ab96cb3..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/overflow/SubMatriochka.java +++ /dev/null @@ -1,9 +0,0 @@ -package fr.inria.overflow; - -import java.util.List; - -public class SubMatriochka { - public & List> int aMethod(Class object) { - return 23; - } - } \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/removebadtest/ClassToBeTested.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/removebadtest/ClassToBeTested.java deleted file mode 100644 index f8bbac98c..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/removebadtest/ClassToBeTested.java +++ /dev/null @@ -1,18 +0,0 @@ -package fr.inria.removebadtest; - -public class ClassToBeTested { - - public int methodInt() { - return 1; - } - - public void methodException() { - throw new RuntimeException(); - } - - public boolean methodBoolean() { - return true; - } - - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassThrowException.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassThrowException.java deleted file mode 100644 index 95c764fa0..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassThrowException.java +++ /dev/null @@ -1,13 +0,0 @@ -package fr.inria.sample; - -/** - * User: Simon - * Date: 25/11/16 - * Time: 13:24 - */ -public class ClassThrowException { - - public void throwException() throws Exception { - throw new Exception(); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithBoolean.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithBoolean.java deleted file mode 100644 index 6512f6bb0..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithBoolean.java +++ /dev/null @@ -1,73 +0,0 @@ -package fr.inria.sample; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Random; - -/** - * User: Simon - * Date: 25/11/16 - * Time: 10:55 - */ -public class ClassWithBoolean { - - public String getNull() { - return null; - } - - public boolean getTrue() { - return true; - } - - public boolean getFalse() { - return false; - } - - public Collection getEmptyList() { - return new ArrayList(); - } - - public String getString() { - return "this.is.a.string"; - } - - public char getChar() { - return 'a'; - } - - public byte getByte() { - return (byte)1; - } - - public short getShort() { - return (short)1; - } - - public int getInt() { - return 1; - } - - public long getLong() { - return (long)1L; - } - - public float getFloat() { - return (float)1.0f; - } - - public double getDouble() { - return (double)1.0D; - } - - public Collection getListWithElements() { - final Collection strings = new ArrayList(); - strings.add("a"); - strings.add("b"); - return strings; - } - - public boolean getBoolean() { - Random r = new Random(23L); - return r.nextBoolean(); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithFieldRead.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithFieldRead.java deleted file mode 100644 index 944782aad..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithFieldRead.java +++ /dev/null @@ -1,26 +0,0 @@ -package fr.inria.sample; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 31/07/18 - */ -public class ClassWithFieldRead { - - public Double getInfinity() { - return Double.NEGATIVE_INFINITY; - } - - public Double getNaN() { - return Double.NaN; - } - - public Integer getMax_VALUE() { - return Integer.MAX_VALUE; - } - - public double[] getDoubles() { - return new double[]{Double.NaN, 0.0F, Double.POSITIVE_INFINITY, 1.0D}; - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithMap.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithMap.java deleted file mode 100644 index b27af50a7..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/sample/ClassWithMap.java +++ /dev/null @@ -1,35 +0,0 @@ -package fr.inria.sample; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 04/03/18. - */ -public class ClassWithMap { - - private Map emptyMap = Collections.emptyMap(); - - private Map fullMap; - - public ClassWithMap(){ - this.fullMap = new HashMap<>(); - this.fullMap.put("key1", "value1"); - this.fullMap.put("key2", "value2"); - this.fullMap.put("key3", "value3"); - } - - public Map getEmptyMap() { - return emptyMap; - } - - public Map getFullMap() { - return fullMap; - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassParameterAmplify.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassParameterAmplify.java deleted file mode 100644 index 6ab1c2c68..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassParameterAmplify.java +++ /dev/null @@ -1,34 +0,0 @@ -package fr.inria.statementadd; - -/** - * Created by bdanglot on 11/30/16. - */ -public class ClassParameterAmplify { - - private int i; - - public ClassParameterAmplify(Integer i) { - this.i = i; - } - - public ClassParameterAmplify(ClassParameterAmplify parameterAmplify) { - this.i = parameterAmplify.i; - } - - public ClassParameterAmplify(ClassParameterAmplify parameterAmplify, Integer i) { - this.i = parameterAmplify.i + i; - } - - public void method1() { - System.out.println(""); - } - - private void method2() { - System.out.println(""); - } - - protected void method3() { - System.out.println(""); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassTarget.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassTarget.java deleted file mode 100644 index cb2e54522..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassTarget.java +++ /dev/null @@ -1,39 +0,0 @@ -package fr.inria.statementadd; - -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Collection; -import java.util.Collections; - -public class ClassTarget { - - public List getList(int parameter) { - return Collections.singletonList(new ClassParameterAmplify(parameter)); - } - - public int getSizeOf(Collection collection) { - return collection.size(); - } - - public int getSizeOfTypedCollection(Collection collection) { - return collection.size(); - } - - public int getSizeOf(Set set) { - return set.size(); - } - - public int getSizeOfTypedCollection(Set set) { - return set.size(); - } - - public int getSizeOf(Map map) { - return map.size(); - } - - public int getSizeOfTypedMap(Map map) { - return map.size(); - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassTargetAmplify.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassTargetAmplify.java deleted file mode 100644 index 1ba0904f1..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementadd/ClassTargetAmplify.java +++ /dev/null @@ -1,28 +0,0 @@ -package fr.inria.statementadd; - -/** - * Created by bdanglot on 11/30/16. - */ -public class ClassTargetAmplify { - - public ClassParameterAmplify methodWithReturn() { - return new ClassParameterAmplify(0); - } - - public void methodWithDomainParameter(ClassParameterAmplify object) { - System.out.println(""); - } - - public void methodWithPrimitifParameters(char c, boolean b, byte by, short s, int i, long l, float f, double d) { - System.out.println(""); - } - - public void methodWithPrimitifParameters(String str, Boolean b, Byte by, Short s, Integer i, Long l, Float f, Double d) { - System.out.println(""); - } - - public void method() { - System.out.println(""); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementaddarray/ClassParameterAmplify.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementaddarray/ClassParameterAmplify.java deleted file mode 100644 index 48753965e..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementaddarray/ClassParameterAmplify.java +++ /dev/null @@ -1,26 +0,0 @@ -package fr.inria.statementaddarray; - -/** - * Created by bdanglot on 11/30/16. - */ -public class ClassParameterAmplify { - - private int i; - - public ClassParameterAmplify(int [] i) { - this.i = i[0]; - } - - public void method1() { - System.out.println(""); - } - - private void method2() { - System.out.println(""); - } - - protected void method3() { - System.out.println(""); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementaddarray/ClassTargetAmplify.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementaddarray/ClassTargetAmplify.java deleted file mode 100644 index c29639f85..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/statementaddarray/ClassTargetAmplify.java +++ /dev/null @@ -1,24 +0,0 @@ -package fr.inria.statementaddarray; - -/** - * Created by bdanglot on 11/30/16. - */ -public class ClassTargetAmplify { - - public void methodWithDomainParameter(ClassParameterAmplify object) { - System.out.println(""); - } - - public ClassParameterAmplify methodWithReturn() { - return new ClassParameterAmplify(new int[] {0}); - } - - public void methodWithArrayParatemeter(int [] a) { - System.out.println(""); - } - - public void methodWithArrayParatemeterFromDomain(ClassParameterAmplify [] array) { - System.out.println(""); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/testrunner/ClassWithVisibility.java b/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/testrunner/ClassWithVisibility.java deleted file mode 100644 index 1cb585c0c..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/main/java/fr/inria/testrunner/ClassWithVisibility.java +++ /dev/null @@ -1,46 +0,0 @@ -package fr.inria.testrunner; - -public class ClassWithVisibility { - - private String summaryObjectStartText = "<"; - - public int method() { - return 1; - } - - protected int methodp() { - return 1; - } - - /** - *

Sets the start text to output when an Object is - * output in summary mode.

- * - *

This is output before the size value.

- * - *

null is accepted, but will be converted to - * an empty String.

- * - * @param summaryObjectStartText the new start of summary text - */ - protected void setSummaryObjectStartText(String summaryObjectStartText) { - if (summaryObjectStartText == null) { - summaryObjectStartText = ""; - } - this.summaryObjectStartText = summaryObjectStartText; - } - - /** - *

Gets the start text to output when an Object is - * output in summary mode.

- * - *

This is output before the size value.

- * - * @return the current start of summary text - */ - protected String getSummaryObjectStartText() { - return summaryObjectStartText; - } - - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/OneLiteralTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/OneLiteralTest.java deleted file mode 100644 index f430634e1..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/OneLiteralTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package fr.inria.amp; - -import org.junit.Test; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 10/08/18 - */ -public class OneLiteralTest { - - @Test - public void test() throws Exception { - String oneLit = ""; - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/TestJavaPoet.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/TestJavaPoet.java deleted file mode 100644 index c8144897b..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/TestJavaPoet.java +++ /dev/null @@ -1,35 +0,0 @@ -package fr.inria.amp; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class TestJavaPoet { - - @Test - public void conflictingNameOutOfScope() throws Exception { - assertEquals(new JavaPoet().method(), "" - + "package com.squareup.tacos;\n" - + "\n" - + "class A {\n" - + " class B {\n" - + " class C {\n" - + " Twin.D d;\n" - + "\n" - + " class Nested {\n" - + " class Twin {\n" - + " }\n" - + " }\n" - + " }\n" - + " }\n" - + "\n" - + " class Twin {\n" - + " class D {\n" - + " }\n" - + " }\n" - + "}\n"); - } - - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/ToBeAmplifiedLiteralTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/ToBeAmplifiedLiteralTest.java deleted file mode 100644 index ad76553f8..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amp/ToBeAmplifiedLiteralTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package fr.inria.ampl; - -import org.junit.Test; - -public class ToBeAmplifiedLiteralTest { - - @Test - public void testInt() throws Exception { - int i1 = 1; - int i2 = 2; - int i3 = i1 + 3 + 5; - String s1 = ""; - String s2 = "toto"; - String s3 = s1 + "hey" + "ho"; - } -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amplified/AmplifiedTestClassWithReferenceToName.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amplified/AmplifiedTestClassWithReferenceToName.java deleted file mode 100644 index c077a4799..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/amplified/AmplifiedTestClassWithReferenceToName.java +++ /dev/null @@ -1,19 +0,0 @@ -package fr.inria.amplified; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 05/09/18 - */ -public class AmplifiedTestClassWithReferenceToName { - - @Test - public void test() throws Exception { - Class clazz = AmplifiedTestClassWithReferenceToName.class; - assertEquals("AmplifiedTestClassWithReferenceToName", clazz.getName()); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/assertionremover/TestClassWithAssertToBeRemoved.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/assertionremover/TestClassWithAssertToBeRemoved.java deleted file mode 100644 index 9dd3f6d39..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/assertionremover/TestClassWithAssertToBeRemoved.java +++ /dev/null @@ -1,40 +0,0 @@ -package fr.inria.assertionremover; - -import org.junit.Test; -import fr.inria.sample.*; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * User: Simon - * Date: 25/11/16 - * Time: 10:58 - */ -public class TestClassWithAssertToBeRemoved { - - public static boolean getNegation(boolean value) { - return !value; - } - - @Test - public void test1() { - ClassWithBoolean cl = new ClassWithBoolean(); - assertTrue(cl.getTrue()); - assertTrue(true); - int one = 1; - switch (one) { - case 1: - assertTrue(getNegation(cl.getFalse())); - break; - } - } - - @Test - public void test2() throws Exception { - int a = -1; - assertEquals(-1, a); - int b = 1; - assertEquals(1, b); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/factory/FactoryTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/factory/FactoryTest.java deleted file mode 100644 index d00714dea..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/factory/FactoryTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package fr.inria.factory; - -import org.junit.Test; - -public class FactoryTest { - - public static class aClass implements aInterface { - private int x; - private aClass(int x) { - this.x = x; - } - private aClass(String s) { - this.x = s.length(); - } - public int getX() { - return x; - } - } - - public interface aInterface { - - } - - public static aClass createAClass() { - return new aClass(1); - } - - public static aClass build(int x) { - return new aClass(x); - } - - @Test - public void test() throws Exception { - final aClass aClass = createAClass(); - } -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/filter/failing/FailingTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/filter/failing/FailingTest.java deleted file mode 100644 index 658a3b0c7..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/filter/failing/FailingTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package fr.inria.filter.failing; - -import org.junit.Test; - -import java.util.ArrayList; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 18/10/17 - */ -public class FailingTest { - - @Test - public void testAssertionError() throws Exception { - assertFalse(true); - } - - @Test - public void testFailingWithException() throws Exception { - String nullString = null; - assertEquals(-1, nullString.length()); - new ArrayList<>().get(-100); - } - - @Test - public void testOutOfMemoryError() throws Exception { - throw new OutOfMemoryError(); - } - - @Test - public void testStackOverFlowError() throws Exception { - throw new StackOverflowError(); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/filter/passing/PassingTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/filter/passing/PassingTest.java deleted file mode 100644 index 6dde83c31..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/filter/passing/PassingTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package fr.inria.filter.passing; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 18/10/17 - */ -public class PassingTest { - - @Test - public void testAssertion() throws Exception { - assertFalse(false); - } - - @Test - public void failingTestCase() throws Exception { - assertFalse(true); - } - - @Test (expected = NullPointerException.class, timeout = 100) - public void testNPEExpected() throws Exception { - String nullString = null; - assertEquals(-1, nullString.length()); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/ClassJunit3.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/ClassJunit3.java deleted file mode 100644 index 4cd77ee55..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/ClassJunit3.java +++ /dev/null @@ -1,17 +0,0 @@ -package fr.inria.helper; - -import static junit.framework.TestCase.assertEquals; - -public class ClassJunit3 { - - class MyInnerClass { - int value; - } - - public void test() { - MyInnerClass innerClass = new MyInnerClass(); - innerClass.value = 4; - assertEquals(4, innerClass.value); - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/ClassWithInnerClass.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/ClassWithInnerClass.java deleted file mode 100644 index dac21996e..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/ClassWithInnerClass.java +++ /dev/null @@ -1,65 +0,0 @@ -package fr.inria.helper; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class ClassWithInnerClass { - - class MyInnerClass { - int value; - } - - @Test - public void test() { - MyInnerClass innerClass = new MyInnerClass(); - innerClass.value = 4; - assertEquals(4, innerClass.value); - } - - @Test - public void notATestBecauseEmpty() { - - } - - @Test - public void notATestBecauseTooDeepCallToAssertion() throws Exception { - methodIntermediate1(); - } - - @Test - public void testWithDeepCallToAssertion() throws Exception { - methodIntermediate2(); - } - - private void methodIntermediate1() { - methodIntermediate2(); - } - - private void methodIntermediate2() { - methodIntermediate3(); - } - - private void methodIntermediate3() { - methodIntermediate4(); - } - - private void methodIntermediate4() { - assertTrue(true); - } - - public void notATestBecauseMixinJunit3AndJunit4() { - assertTrue(true); - } - - @Test - public void notATestBecauseParameters(int a) { - assertTrue(true); - } - - @org.junit.jupiter.api.Test - public void Junit5Test() { - org.junit.jupiter.api.Assertions.assertTrue(true); - System.out.println("this is a test JUNIT 5 because of the annotation"); - } -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/GoogleTruthTestClass.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/GoogleTruthTestClass.java deleted file mode 100644 index 202927eee..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/GoogleTruthTestClass.java +++ /dev/null @@ -1,24 +0,0 @@ -package fr.inria.helper; - -import static com.google.common.truth.Truth.*; - -import org.junit.Test; - -/** - * created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 12/11/18 - */ -public class GoogleTruthTestClass { - - - @Test - public void test() { - String s = ""; - assertThat(s).isEmpty(); - assertThat("").isEqualTo(""); - assertThat("").isNotEqualTo(" "); - assertThat(0.0F).isNotNaN(); - assertThat(true).isTrue(); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/SecondClassJUnit3.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/SecondClassJUnit3.java deleted file mode 100644 index e3d936383..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/SecondClassJUnit3.java +++ /dev/null @@ -1,30 +0,0 @@ -package fr.inria.helper; - -import junit.framework.TestCase; - -public class SecondClassJUnit3 extends TestCase { - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - public void test() { - assertEquals(3, 3); - } - - public void should() { - assertTrue(true); - } - - public void testExpectingAnException() { - assertTrue(true); - throw new RuntimeException(); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/SubClassOfJUnit3.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/SubClassOfJUnit3.java deleted file mode 100644 index 85c5e28ec..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/SubClassOfJUnit3.java +++ /dev/null @@ -1,14 +0,0 @@ -package fr.inria.helper; - -public class SubClassOfJUnit3 extends SecondClassJUnit3 { - - @Override - public void test() { - assertEquals(3, 3); - } - - public void testThatIsATest() { - assertEquals(3,3); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/TestWithMultipleAsserts.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/TestWithMultipleAsserts.java deleted file mode 100644 index f59670a75..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/helper/TestWithMultipleAsserts.java +++ /dev/null @@ -1,40 +0,0 @@ -package fr.inria.helper; - -import com.google.common.truth.Truth; -import org.junit.Test; - -import static org.assertj.core.api.BDDAssertions.then; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - - -public class TestWithMultipleAsserts { - - @Test - public void test() { - verify(null); - assertEquals("", ""); - String s = ""; - Truth.assertThat(s).isEmpty(); - Truth.assertThat("").isEqualTo(""); - Truth.assertThat(0.0F).isNotNaN(); - System.out.println(""); - System.out.println(""); - then(0).isInstanceOf(int.class).hasSameClassAs(0); - notVerify(); - } - - @Test - public void testThrownException() { - throw new RuntimeException(); - } - - private void notVerify() { - // empty - } - - private void verify(String s) { - assertNull(s); - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/infinite/LoopTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/infinite/LoopTest.java deleted file mode 100644 index 65cf33f2b..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/infinite/LoopTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package fr.inria.infinite; - -import org.junit.Test; - -public class LoopTest { - - @Test(timeout = 1000L) - public void testLoop() throws Exception { - final Loop loop = new Loop(); - loop.infinite(); - } -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherit.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherit.java deleted file mode 100644 index 29ef5d7da..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherit.java +++ /dev/null @@ -1,9 +0,0 @@ -package fr.inria.inheritance; - -public class Inherit extends fr.inria.inheritance.Inherited { - - public int getValueToBeAsserted() { - return 0; - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherit2.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherit2.java deleted file mode 100644 index e6caf682f..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherit2.java +++ /dev/null @@ -1,18 +0,0 @@ -package fr.inria.inheritance; - -import org.junit.Test; - -import static org.junit.Assert.assertTrue; - -public class Inherit2 extends fr.inria.inheritance.Inherited { - - public int getValueToBeAsserted() { - return 0; - } - - @Test - public void myTest() { - assertTrue(true); - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherited.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherited.java deleted file mode 100644 index 689f67a75..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/inheritance/Inherited.java +++ /dev/null @@ -1,22 +0,0 @@ - -package fr.inria.inheritance; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public abstract class Inherited { - - public abstract int getValueToBeAsserted(); - - @Test - public void test() { - assertEquals(1, new fr.inria.inheritance.InheritanceSource().method(getValueToBeAsserted())); - } - - @Test - public void test2() { - assertEquals(1, new fr.inria.inheritance.InheritanceSource().method(getValueToBeAsserted())); - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/lombok/LombokClassThatUseBuilderTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/lombok/LombokClassThatUseBuilderTest.java deleted file mode 100644 index 58d89dc3b..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/lombok/LombokClassThatUseBuilderTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package fr.inria.lombok; - -import org.junit.Test; - -/** - * created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 06/12/18 - */ -public class LombokClassThatUseBuilderTest { - - @Test - public void test() { - LombokClassThatUseBuilder.builder().build(); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/multipleobservations/TestClassToBeTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/multipleobservations/TestClassToBeTest.java deleted file mode 100644 index 18fe83a2d..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/multipleobservations/TestClassToBeTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package fr.inria.multipleobservations; - -import org.junit.Test; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 04/10/17 - */ -public class TestClassToBeTest { - - @Test - public void test() throws Exception { - final ClassToBeTest classToBeTest = new ClassToBeTest(); - classToBeTest.method(); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/mutation/ClassUnderTestTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/mutation/ClassUnderTestTest.java deleted file mode 100644 index 1bf112efc..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/mutation/ClassUnderTestTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package fr.inria.mutation; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class ClassUnderTestTest { - - @Test - public void testLit() { - ClassUnderTest underTest = new ClassUnderTest(); - assertEquals(1, underTest.plusOne(0)); - } - - @Test - public void testAddCall() throws Exception { - ClassUnderTest underTest = new ClassUnderTest(); - underTest.plusOne(0); - underTest.minusOne(1); - } - - @Test - public void testWithIf() throws Exception { - ClassUnderTest underTest = new ClassUnderTest(); - if (underTest.getBoolean()) { - assertTrue(true); - } - if (! (underTest.getBoolean())) { - assertTrue(true); - } - } -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/preparation/MustBeRenamedFromStart.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/preparation/MustBeRenamedFromStart.java deleted file mode 100644 index c000b0c16..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/preparation/MustBeRenamedFromStart.java +++ /dev/null @@ -1,30 +0,0 @@ -package fr.inria.preparation; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 08/08/18 - */ -public class MustBeRenamedFromStart { - - public class Inner { - public String getName() { - return Inner.class.getTypeName(); - } - @Override - public int hashCode() { - return this.getName().hashCode(); - } - } - - @Test - public void test() { - final Inner inner = new Inner(); - assertEquals("fr.inria.preparation.MustBeRenamedFromStart$Inner", inner.getName()); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/removebadtest/TestClassToBeTested.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/removebadtest/TestClassToBeTested.java deleted file mode 100644 index 0ae50f3c4..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/removebadtest/TestClassToBeTested.java +++ /dev/null @@ -1,40 +0,0 @@ -package fr.inria.removebadtest; - -import org.junit.Test; -import junit.framework.TestCase; - - -public class TestClassToBeTested { - - @Test - public void testKeep() throws Exception { - ClassToBeTested classToBeTested = new ClassToBeTested(); - org.junit.Assert.assertEquals(1, classToBeTested.methodInt()); - org.junit.Assert.assertTrue(classToBeTested.methodBoolean()); - try { - classToBeTested.methodException(); - TestCase.fail(); - } catch (Exception e) { - //success; - } - } - - @Test - public void testRemove1() throws Exception { - ClassToBeTested classToBeTested = new ClassToBeTested(); - org.junit.Assert.assertEquals(2, classToBeTested.methodInt()); - } - - @Test - public void testRemove2() throws Exception { - ClassToBeTested classToBeTested = new ClassToBeTested(); - org.junit.Assert.assertFalse(classToBeTested.methodBoolean()); - } - - @Test - public void testRemove3() throws Exception { - ClassToBeTested classToBeTested = new ClassToBeTested(); - classToBeTested.methodException(); - } - -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithAssert.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithAssert.java deleted file mode 100644 index 9f93aba21..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithAssert.java +++ /dev/null @@ -1,74 +0,0 @@ -package fr.inria.sample; - -import org.junit.Test; - -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * User: Simon - * Date: 25/11/16 - * Time: 10:58 - */ -public class TestClassWithAssert extends TestClassWithAssertOld { - - @Test - public void testWithCatchVariable() throws Exception { - try { - System.out.println(""); - } catch (Exception e) { - assertThat(e).isInstanceOf(Exception.class); - } - } - - @Test - public void test1() { - ClassWithBoolean cl = new ClassWithBoolean(); - assertTrue(cl.getTrue()); - assertTrue(true); - } - - @Test - public void test1_withoutAssert() { - ClassWithBoolean cl = new ClassWithBoolean(); - Object o_3_0 = cl.getTrue(); - } - - @Test - public void test2() { - ClassWithBoolean cl = new ClassWithBoolean(); - assertTrue(cl.getTrue()); - assertTrue(cl.getFalse()); - } - - @Test - public void test2_RemoveFailAssert() { - ClassWithBoolean cl = new ClassWithBoolean(); - assertTrue(cl.getTrue()); - Object o_5_0 = cl.getFalse(); - } - - @Test - public void test3() throws Exception { - ClassThrowException cl = new ClassThrowException(); - cl.throwException(); - } - - @Test - public void test3_exceptionCatch() throws Exception { - try { - ClassThrowException cl = new ClassThrowException(); - cl.throwException(); - junit.framework.TestCase.fail("test3 should have thrown Exception"); - } catch (java.lang.Exception eee) { - } finally { - // - } - } - - @Test - public void testWithArray() throws Exception { - assertEquals(new Integer[]{1,2}, new Integer[]{1,2}); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithAssertOld.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithAssertOld.java deleted file mode 100644 index 61a4adcdb..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithAssertOld.java +++ /dev/null @@ -1,20 +0,0 @@ -package fr.inria.sample; - -import org.junit.Test; - -import static org.junit.Assert.assertTrue; - -/** - * User: Simon - * Date: 25/11/16 - * Time: 10:58 - */ -public class TestClassWithAssertOld { - - @Test - public void anOldTest() throws Exception { - ClassWithBoolean cl = new ClassWithBoolean(); - assertTrue(cl.getTrue()); - assertTrue(true); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithFieldRead.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithFieldRead.java deleted file mode 100644 index f6c7e1b2d..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithFieldRead.java +++ /dev/null @@ -1,16 +0,0 @@ -package fr.inria.sample; - -import org.junit.Test; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 31/07/18 - */ -public class TestClassWithFieldRead { - - @Test - public void test() throws Exception { - final ClassWithFieldRead classWithFieldRead = new ClassWithFieldRead(); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithLiteral.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithLiteral.java deleted file mode 100644 index 4b80f8993..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithLiteral.java +++ /dev/null @@ -1,9 +0,0 @@ -package fr.inria.sample; - -/** - * User: Simon - * Date: 25/11/16 - * Time: 13:40 - */ -public class TestClassWithLiteral { -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithLoop.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithLoop.java deleted file mode 100644 index 2b9aaabb3..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithLoop.java +++ /dev/null @@ -1,59 +0,0 @@ -package fr.inria.sample; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 29/03/18 - */ -public class TestClassWithLoop { - - @Test - public void test() throws Exception { - int[] array = new int[]{1, 2, 3, 4, 5}; - // with bracket - for (int i = 0; i < array.length; i++) { - assertEquals(i+1, array[i]); - array[i] += 1; - } - // without bracket - for (int i = 0; i < array.length; i++) - assertEquals(i+2, array[i]); - } - - class MyClass { - private int internal = 0; - public int getInteger() { - return this.internal; - } - public void inc() { - this.internal++; - } - } - - @Test - public void test2() throws Exception { - List list = new ArrayList<>(); - list.add(new MyClass()); - list.add(new MyClass()); - list.add(new MyClass()); - - for (MyClass myClass : list) { - assertEquals(0, myClass.getInteger()); - } - - for (MyClass myClass : list) { - myClass.inc(); - } - - for (MyClass myClass : list) { - assertEquals(1, myClass.getInteger()); - } - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithSpecificCaseToBeAsserted.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithSpecificCaseToBeAsserted.java deleted file mode 100644 index cafa11992..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithSpecificCaseToBeAsserted.java +++ /dev/null @@ -1,24 +0,0 @@ - -package fr.inria.sample; - -import java.util.Comparator; - -import org.junit.Test; - -public class TestClassWithSpecificCaseToBeAsserted { - - @Test - public void test1() { - - int a = 0; - int b = 1; - - new Comparator() { - @Override - public int compare(Integer integer, Integer t1) { - return integer - t1; - } - }.compare(a, b); - - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithoutAssert.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithoutAssert.java deleted file mode 100644 index 316f6c4a0..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithoutAssert.java +++ /dev/null @@ -1,47 +0,0 @@ -package fr.inria.sample; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * User: Simon - * Date: 25/11/16 - * Time: 13:39 - */ -public class TestClassWithoutAssert { - - @Test - public void test1() { - ClassWithBoolean cl = new ClassWithBoolean(); - cl.getFalse(); - cl.getBoolean(); - java.io.File file = new java.io.File(""); - boolean var = cl.getTrue(); - } - - @Test - public void test2() { - ClassWithBoolean cl = new ClassWithBoolean(); - cl.getFalse(); - cl.getFalse(); - cl.getFalse(); - } - - @Test - public void test3() throws Exception { - final fr.inria.sample.ClassWithMap classWithMap = new fr.inria.sample.ClassWithMap(); - classWithMap.getFullMap(); - } - - @Test - public void testOnClass() throws Exception { - class MyClass { - public Class typeClass() { - return MyClass.class; - } - } - MyClass clazz = new MyClass(); - assertEquals(MyClass.class, clazz.typeClass()); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithoutAssertJUnit5.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithoutAssertJUnit5.java deleted file mode 100644 index 0fdd624ea..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/sample/TestClassWithoutAssertJUnit5.java +++ /dev/null @@ -1,48 +0,0 @@ -package fr.inria.sample; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * User: Simon - * Date: 25/11/16 - * Time: 13:39 - */ -public class TestClassWithoutAssertJUnit5 { - - @Test - public void test1() { - ClassWithBoolean cl = new ClassWithBoolean(); - cl.getFalse(); - cl.getBoolean(); - java.io.File file = new java.io.File(""); - boolean var = cl.getTrue(); - } - - @Test - public void test2() { - ClassWithBoolean cl = new ClassWithBoolean(); - cl.getFalse(); - cl.getFalse(); - cl.getFalse(); - } - - @Test - public void test3() throws Exception { - final fr.inria.sample.ClassWithMap classWithMap = new fr.inria.sample.ClassWithMap(); - classWithMap.getFullMap(); - } - - @Test - public void testOnClass() throws Exception { - class MyClass { - public Class typeClass() { - return MyClass.class; - } - } - MyClass clazz = new MyClass(); - assertEquals(MyClass.class, clazz.typeClass()); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementadd/TestClassTarget.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementadd/TestClassTarget.java deleted file mode 100644 index 9fe6b2900..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementadd/TestClassTarget.java +++ /dev/null @@ -1,28 +0,0 @@ -package fr.inria.statementadd; - -import org.junit.Test; - -import java.util.ArrayList; - - -public class TestClassTarget { - - @Test - public void test() throws Exception { - ClassTarget clazz = new ClassTarget(); - } - - class Internal { - public int compute(int i) { - return (int) Math.pow(2, i); - } - } - - @Test - public void testWithLoop() throws Exception { - ArrayList internalList = new ArrayList<>(); - internalList.add(new Internal()); - for (Internal i : internalList) - i.compute(0); - } -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementadd/TestClassTargetAmplify.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementadd/TestClassTargetAmplify.java deleted file mode 100644 index 3f41caa10..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementadd/TestClassTargetAmplify.java +++ /dev/null @@ -1,16 +0,0 @@ -package fr.inria.statementadd; - -import org.junit.Test; - -/** - * Created by bdanglot on 11/30/16. - */ -public class TestClassTargetAmplify { - - @Test - public void test() throws Exception { - ClassTargetAmplify clazz = new ClassTargetAmplify(); - clazz.methodWithReturn(); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementaddarray/TestClassTargetAmplify.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementaddarray/TestClassTargetAmplify.java deleted file mode 100644 index 563f8e25f..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/statementaddarray/TestClassTargetAmplify.java +++ /dev/null @@ -1,16 +0,0 @@ -package fr.inria.statementaddarray; - -import org.junit.Test; - -/** - * Created by bdanglot on 11/30/16. - */ -public class TestClassTargetAmplify { - - @Test - public void test() throws Exception { - ClassTargetAmplify clazz = new ClassTargetAmplify(); - clazz.methodWithReturn(); - } - -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/systemproperties/SystemPropertiesTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/systemproperties/SystemPropertiesTest.java deleted file mode 100644 index 08d07a830..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/systemproperties/SystemPropertiesTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package fr.inria.systemproperties; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 26/10/17 - */ -public class SystemPropertiesTest { - - @Test - public void testSystemProperties() throws Exception { - assertEquals("toto", System.getProperty("admin")); - assertEquals("tata", System.getProperty("passwd")); - assertEquals("toto", System.getProperties().get("admin")); - assertEquals("tata", System.getProperties().get("passwd")); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit3.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit3.java deleted file mode 100644 index 6a76c77dd..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit3.java +++ /dev/null @@ -1,15 +0,0 @@ -package fr.inria.testframework; - -import junit.framework.TestCase; - -/** - * created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 07/11/18 - */ -public class TestSupportJUnit3 extends TestCase { - - public void testJUnit3() { - assertTrue(true); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit4.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit4.java deleted file mode 100644 index 873c7cbaa..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit4.java +++ /dev/null @@ -1,18 +0,0 @@ -package fr.inria.testframework; - -import org.junit.Test; - -import static org.junit.Assert.assertTrue; - -/** - * created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 07/11/18 - */ -public class TestSupportJUnit4 { - - @Test - public void testJUnit4() { - assertTrue(true); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit5.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit5.java deleted file mode 100644 index 9da742492..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testframework/TestSupportJUnit5.java +++ /dev/null @@ -1,36 +0,0 @@ -package fr.inria.testframework; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 07/11/18 - */ -public class TestSupportJUnit5 { - - @Test - public void testJUnit5() { - assertTrue(true); - } - - @Test - public void testExpectAnException() { - assertTrue(true); - throwAnException(); - } - - @Test - public void testExpectAnExceptionAmplified() { - assertThrows(RuntimeException.class, () -> { - throwAnException(); - }); - } - - private void throwAnException() { - throw new RuntimeException(); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testresources/TestResources.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testresources/TestResources.java deleted file mode 100644 index 3be6d66d9..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testresources/TestResources.java +++ /dev/null @@ -1,14 +0,0 @@ -package fr.inria.testresources; - -import org.junit.Test; - -import static org.junit.Assert.assertNotNull; - -public class TestResources { - - @Test - public void testResources() throws Exception { - assertNotNull(TestResources.class.getClassLoader().getResourceAsStream("aResource")); - assertNotNull(TestResources.class.getClassLoader().getResourceAsStream("aResourcesDirectory/anotherResource")); - } -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testrunner/TestClassWithVisibility.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testrunner/TestClassWithVisibility.java deleted file mode 100644 index cb1a8bab1..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/testrunner/TestClassWithVisibility.java +++ /dev/null @@ -1,25 +0,0 @@ -package fr.inria.testrunner; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class TestClassWithVisibility { - - @Test - public void test() throws Exception { - assertEquals(1, new ClassWithVisibility().method()); - } - - @Test - public void testp() throws Exception { - assertEquals(1, new ClassWithVisibility().methodp()); - } - - @Test - public void testFromCommonsLang() throws Exception { - final ClassWithVisibility style = new ClassWithVisibility(); - style.setSummaryObjectStartText(null); - assertEquals("", style.getSummaryObjectStartText()); - } -} \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/workload/WorkloadTest.java b/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/workload/WorkloadTest.java deleted file mode 100644 index 7d2fe13ac..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/java/fr/inria/workload/WorkloadTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package fr.inria.workload; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 17/07/18 - */ -public class WorkloadTest { - - public class Workload { - private int a = 0; - public void run(int a, int b, int c, int d, int e) { - for (int i = 0 ; i < 10E6 ; i++) { - a = a + i % 5; - } - this.a = a; - } - public int getA() { - return this.a; - } - } - - @Test - public void test() throws Exception { - final Workload workload = new Workload(); - int s = 0; - ((fr.inria.workload.WorkloadTest.Workload) workload).run(0, 0, 0, 0, s); - assertTrue(0 != workload.getA()); - assertEquals(0, s); - } -} diff --git a/dspot-prettifier/src/test/resources/sample/src/test/resources/aResource b/dspot-prettifier/src/test/resources/sample/src/test/resources/aResource deleted file mode 100644 index 6cb1e50e0..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/resources/aResource +++ /dev/null @@ -1 +0,0 @@ -this is a resource \ No newline at end of file diff --git a/dspot-prettifier/src/test/resources/sample/src/test/resources/aResourcesDirectory/anotherResource b/dspot-prettifier/src/test/resources/sample/src/test/resources/aResourcesDirectory/anotherResource deleted file mode 100644 index c2f368dfa..000000000 --- a/dspot-prettifier/src/test/resources/sample/src/test/resources/aResourcesDirectory/anotherResource +++ /dev/null @@ -1 +0,0 @@ -this is another resource \ No newline at end of file diff --git a/dspot/pom.xml b/dspot/pom.xml index b00199377..134e5b059 100644 --- a/dspot/pom.xml +++ b/dspot/pom.xml @@ -11,7 +11,7 @@ dspot jar - DSpot + DSpot - Core