From f7a67cf7bff343e9417b441f2b700137f6f989ba Mon Sep 17 00:00:00 2001 From: Tomasz Zielinski Date: Tue, 31 Jul 2018 19:24:41 +0200 Subject: [PATCH] refactor: fix more unused exceptions --- .../spoon/processing/CtGenerationTest.java | 6 ++--- .../declaration/CtTypeInformationTest.java | 2 +- .../CtInheritanceScannerMethodsTest.java | 2 +- .../visitor/CtInheritanceScannerTest.java | 2 +- .../spoon/reflect/visitor/CtIteratorTest.java | 2 +- .../spoon/reflect/visitor/CtScannerTest.java | 6 ++--- .../spoon/reflect/visitor/CtVisitorTest.java | 2 +- .../test/ctType/CtTypeParameterTest.java | 2 +- .../java/spoon/test/ctType/CtTypeTest.java | 6 ++--- src/test/java/spoon/test/enums/EnumsTest.java | 2 +- src/test/java/spoon/test/eval/EvalTest.java | 6 ++--- .../spoon/test/executable/ExecutableTest.java | 2 +- .../java/spoon/test/factory/FactoryTest.java | 2 +- src/test/java/spoon/test/field/FieldTest.java | 4 ++-- .../test/fieldaccesses/FieldAccessTest.java | 10 ++++---- .../DefaultPrettyPrinterTest.java | 8 +++---- .../ExecutableReferenceGenericTest.java | 24 +++++++++---------- .../reference/ExecutableReferenceTest.java | 6 ++--- .../spoon/testing/CtPackageAssertTest.java | 8 +++---- .../java/spoon/testing/FileAssertTest.java | 2 +- 20 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/test/java/spoon/processing/CtGenerationTest.java b/src/test/java/spoon/processing/CtGenerationTest.java index aa1270e4dfd..f0f7a566e42 100644 --- a/src/test/java/spoon/processing/CtGenerationTest.java +++ b/src/test/java/spoon/processing/CtGenerationTest.java @@ -82,7 +82,7 @@ public void testGenerateReplacementVisitor() throws Exception { } @Test - public void testGenerateCtBiScanner() throws Exception { + public void testGenerateCtBiScanner() { // contract: generates the biscanner that is used for equality checking final Launcher launcher = new Launcher(); launcher.getEnvironment().setNoClasspath(true); @@ -111,7 +111,7 @@ public void testGenerateCtBiScanner() throws Exception { } @Test - public void testGenerateCloneVisitor() throws Exception { + public void testGenerateCloneVisitor() { // contract: generates CloneBuilder.java and CloneBuilder.java final Launcher launcher = new Launcher(); launcher.getEnvironment().setNoClasspath(true); @@ -159,7 +159,7 @@ public void testGenerateCloneVisitor() throws Exception { } @Test - public void testGenerateRoleHandler() throws Exception { + public void testGenerateRoleHandler() { final Launcher launcher = new Launcher(); launcher.getEnvironment().setAutoImports(true); launcher.getEnvironment().setNoClasspath(true); diff --git a/src/test/java/spoon/reflect/declaration/CtTypeInformationTest.java b/src/test/java/spoon/reflect/declaration/CtTypeInformationTest.java index 8009508b197..75f5ebe0fe1 100644 --- a/src/test/java/spoon/reflect/declaration/CtTypeInformationTest.java +++ b/src/test/java/spoon/reflect/declaration/CtTypeInformationTest.java @@ -141,7 +141,7 @@ public void testGetAllMethodsReturnsTheRightNumber() { } @Test - public void testGetSuperclass() throws Exception { + public void testGetSuperclass() { final CtType extendsArrayList = this.factory.Type().get(ExtendsArrayList.class); // only 1 method directly in this class diff --git a/src/test/java/spoon/reflect/visitor/CtInheritanceScannerMethodsTest.java b/src/test/java/spoon/reflect/visitor/CtInheritanceScannerMethodsTest.java index a940ef9311d..cc06f5ea50c 100644 --- a/src/test/java/spoon/reflect/visitor/CtInheritanceScannerMethodsTest.java +++ b/src/test/java/spoon/reflect/visitor/CtInheritanceScannerMethodsTest.java @@ -24,7 +24,7 @@ public class CtInheritanceScannerMethodsTest { @Test - public void testMethodsInInheritanceScanner() throws Exception { + public void testMethodsInInheritanceScanner() { // contract: CtInheritanceScanner must declare all scanner and visitor methods. final Launcher launcher = new Launcher(); launcher.setArgs(new String[] {"--output-type", "nooutput" }); diff --git a/src/test/java/spoon/reflect/visitor/CtInheritanceScannerTest.java b/src/test/java/spoon/reflect/visitor/CtInheritanceScannerTest.java index 65037be5ee0..ae4837b1c8f 100644 --- a/src/test/java/spoon/reflect/visitor/CtInheritanceScannerTest.java +++ b/src/test/java/spoon/reflect/visitor/CtInheritanceScannerTest.java @@ -61,7 +61,7 @@ public static Collection data() throws Exception { * @return * @throws Exception */ - private List getMethodToInvoke(Class entry) throws Exception { + private List getMethodToInvoke(Class entry) { Queue> tocheck = new LinkedList<>(); tocheck.add(entry); diff --git a/src/test/java/spoon/reflect/visitor/CtIteratorTest.java b/src/test/java/spoon/reflect/visitor/CtIteratorTest.java index 0bce30f2d97..6ee4751667c 100644 --- a/src/test/java/spoon/reflect/visitor/CtIteratorTest.java +++ b/src/test/java/spoon/reflect/visitor/CtIteratorTest.java @@ -12,7 +12,7 @@ public class CtIteratorTest { @Test - public void testCtElementIteration() throws Exception { + public void testCtElementIteration() { // contract: CtIterator must go over all nodes in dfs order final Launcher launcher = new Launcher(); launcher.setArgs(new String[]{"--output-type", "nooutput"}); diff --git a/src/test/java/spoon/reflect/visitor/CtScannerTest.java b/src/test/java/spoon/reflect/visitor/CtScannerTest.java index a8ee3999b78..33a5606aa2b 100644 --- a/src/test/java/spoon/reflect/visitor/CtScannerTest.java +++ b/src/test/java/spoon/reflect/visitor/CtScannerTest.java @@ -62,7 +62,7 @@ public class CtScannerTest { @Test - public void testScannerContract() throws Exception { + public void testScannerContract() { // contract: CtScanner must call enter and exit methods in each visit methods. final Launcher launcher = new Launcher(); launcher.setArgs(new String[] {"--output-type", "nooutput" }); @@ -112,7 +112,7 @@ private String computeSimpleSignature(CtMethod m) { } @Test - public void testScannerCallsAllProperties() throws Exception { + public void testScannerCallsAllProperties() { // contract: CtScanner must visit all metamodel properties and use correct CtRole! final Launcher launcher = new Launcher(); launcher.addInputResource("./src/main/java/spoon/reflect/"); @@ -220,7 +220,7 @@ public boolean matches(CtInvocation element) { } @Test - public void testScan() throws Exception { + public void testScan() { // contract: all AST nodes are visisted through method "scan" Launcher launcher; launcher = new Launcher(); diff --git a/src/test/java/spoon/reflect/visitor/CtVisitorTest.java b/src/test/java/spoon/reflect/visitor/CtVisitorTest.java index d87431799c9..ac816f944e4 100644 --- a/src/test/java/spoon/reflect/visitor/CtVisitorTest.java +++ b/src/test/java/spoon/reflect/visitor/CtVisitorTest.java @@ -24,7 +24,7 @@ public class CtVisitorTest { @Test - public void testMethodsInVisitor() throws Exception { + public void testMethodsInVisitor() { // contract: CtVisitor must declare all visit methods. final Launcher launcher = new Launcher(); launcher.setArgs(new String[] {"--output-type", "nooutput" }); diff --git a/src/test/java/spoon/test/ctType/CtTypeParameterTest.java b/src/test/java/spoon/test/ctType/CtTypeParameterTest.java index 9df70d84bdb..ee12714d201 100644 --- a/src/test/java/spoon/test/ctType/CtTypeParameterTest.java +++ b/src/test/java/spoon/test/ctType/CtTypeParameterTest.java @@ -67,7 +67,7 @@ private void checkTypeParamErasureOfType(CtTypeParameter typeParam, Class cla assertEquals("TypeErasure of type param "+getTypeParamIdentification(typeParam), field.getType().getName(), typeParam.getTypeErasure().getQualifiedName()); } - private void checkTypeParamErasureOfExecutable(CtTypeParameter typeParam) throws NoSuchFieldException, SecurityException { + private void checkTypeParamErasureOfExecutable(CtTypeParameter typeParam) throws SecurityException { CtExecutable exec = (CtExecutable) typeParam.getParent(); CtParameter param = exec.filterChildren(new NamedElementFilter<>(CtParameter.class,"param"+typeParam.getSimpleName())).first(); assertNotNull("Missing param"+typeParam.getSimpleName() + " in "+ exec.getSignature(), param); diff --git a/src/test/java/spoon/test/ctType/CtTypeTest.java b/src/test/java/spoon/test/ctType/CtTypeTest.java index b9457d1038e..2ea5912213d 100644 --- a/src/test/java/spoon/test/ctType/CtTypeTest.java +++ b/src/test/java/spoon/test/ctType/CtTypeTest.java @@ -56,7 +56,7 @@ public void testHasMethodOnNull() { } @Test - public void testHasMethodInSuperClass() throws Exception { + public void testHasMethodInSuperClass() { final Launcher launcher = new Launcher(); launcher.addInputResource("./src/test/java/spoon/test/ctType/testclasses/X.java"); launcher.run(); @@ -69,7 +69,7 @@ public void testHasMethodInSuperClass() throws Exception { } @Test - public void testHasMethodInDefaultMethod() throws Exception { + public void testHasMethodInDefaultMethod() { final Launcher launcher = new Launcher(); launcher.addInputResource("./src/test/java/spoon/test/ctType/testclasses/X.java"); launcher.getEnvironment().setComplianceLevel(8); @@ -135,7 +135,7 @@ public void testIsSubTypeOfonTypeParameters() throws Exception { } @Test - public void testIsSubTypeOfonTypeReferences() throws Exception { + public void testIsSubTypeOfonTypeReferences() { final Launcher launcher = new Launcher(); launcher.setArgs(new String[]{"-c"}); launcher.addInputResource("./src/test/java/spoon/test/ctType/testclasses/SubtypeModel.java"); diff --git a/src/test/java/spoon/test/enums/EnumsTest.java b/src/test/java/spoon/test/enums/EnumsTest.java index ca6e26f00fb..7e26aeb56f8 100644 --- a/src/test/java/spoon/test/enums/EnumsTest.java +++ b/src/test/java/spoon/test/enums/EnumsTest.java @@ -46,7 +46,7 @@ public void testModelBuildingEnum() throws Exception { } @Test - public void testAnnotationsOnEnum() throws Exception { + public void testAnnotationsOnEnum() { final Launcher launcher = new Launcher(); launcher.run(new String[] { "-i", "./src/test/java/spoon/test/enums/testclasses", diff --git a/src/test/java/spoon/test/eval/EvalTest.java b/src/test/java/spoon/test/eval/EvalTest.java index 8e3915f4cb6..6ecbce756b7 100644 --- a/src/test/java/spoon/test/eval/EvalTest.java +++ b/src/test/java/spoon/test/eval/EvalTest.java @@ -110,7 +110,7 @@ public void testDoNotSimplifyToExpressionWhenStatementIsExpected() throws Except } @Test - public void testVisitorPartialEvaluator_binary() throws Exception { + public void testVisitorPartialEvaluator_binary() { Launcher launcher = new Launcher(); { // binary operator @@ -144,7 +144,7 @@ public void testVisitorPartialEvaluator_binary() throws Exception { } @Test - public void testVisitorPartialEvaluator_if() throws Exception { + public void testVisitorPartialEvaluator_if() { Launcher launcher = new Launcher(); { // the untaken branch is removed CtCodeElement el = launcher.getFactory().Code().createCodeSnippetStatement("if (false) {System.out.println(\"foo\");} else {System.out.println(\"bar\");} ").compile(); @@ -158,7 +158,7 @@ public void testVisitorPartialEvaluator_if() throws Exception { } @Test - public void testVisitorPartialEvaluatorScanner() throws Exception { + public void testVisitorPartialEvaluatorScanner() { Launcher launcher = new Launcher(); launcher.addInputResource("src/test/java/spoon/test/eval/testclasses/Foo.java"); launcher.buildModel(); diff --git a/src/test/java/spoon/test/executable/ExecutableTest.java b/src/test/java/spoon/test/executable/ExecutableTest.java index acdef295136..2f877230746 100644 --- a/src/test/java/spoon/test/executable/ExecutableTest.java +++ b/src/test/java/spoon/test/executable/ExecutableTest.java @@ -24,7 +24,7 @@ public class ExecutableTest { @Test - public void testInfoInsideAnonymousExecutable() throws Exception { + public void testInfoInsideAnonymousExecutable() { final Launcher launcher = new Launcher(); launcher.setArgs(new String[] {"--output-type", "nooutput" }); launcher.addInputResource("./src/test/java/spoon/test/executable/testclasses/AnonymousExecutableSample.java"); diff --git a/src/test/java/spoon/test/factory/FactoryTest.java b/src/test/java/spoon/test/factory/FactoryTest.java index 1d17b17b350..4ea3696a1c2 100644 --- a/src/test/java/spoon/test/factory/FactoryTest.java +++ b/src/test/java/spoon/test/factory/FactoryTest.java @@ -103,7 +103,7 @@ public void testClassAccessCreatedFromFactories() throws Exception { } @Test - public void testCtModel() throws Exception { + public void testCtModel() { SpoonAPI spoon = new Launcher(); spoon.addInputResource("src/test/java/spoon/test/factory/testclasses"); spoon.buildModel(); diff --git a/src/test/java/spoon/test/field/FieldTest.java b/src/test/java/spoon/test/field/FieldTest.java index 045a8a08a40..c4e139e41c5 100644 --- a/src/test/java/spoon/test/field/FieldTest.java +++ b/src/test/java/spoon/test/field/FieldTest.java @@ -48,7 +48,7 @@ public class FieldTest { @Test - public void testAddAFieldInAClassAtAPositionGiven() throws Exception { + public void testAddAFieldInAClassAtAPositionGiven() { final Factory factory = createFactory(); final CtClass fieldClass = factory.Class().create("FieldClass"); @@ -127,7 +127,7 @@ private CtField createField(Factory factory, HashSet modi } @Test - public void testGetDefaultExpression() throws Exception { + public void testGetDefaultExpression() { Launcher spoon = new Launcher(); spoon.addInputResource("./src/test/java/spoon/test/field/testclasses/A.java"); spoon.addInputResource("./src/test/java/spoon/test/field/testclasses/BaseClass.java"); diff --git a/src/test/java/spoon/test/fieldaccesses/FieldAccessTest.java b/src/test/java/spoon/test/fieldaccesses/FieldAccessTest.java index 9e8961f3eac..a61393e5c56 100644 --- a/src/test/java/spoon/test/fieldaccesses/FieldAccessTest.java +++ b/src/test/java/spoon/test/fieldaccesses/FieldAccessTest.java @@ -203,7 +203,7 @@ public void testFieldAccessInAnonymousClass() throws Exception { @Test - public void testFieldAccessNoClasspath() throws Exception { + public void testFieldAccessNoClasspath() { Launcher launcher = new Launcher(); launcher.addInputResource("src/test/resources/import-resources/fr/inria/"); launcher.getEnvironment().setNoClasspath(true); @@ -292,7 +292,7 @@ public void testTypeDeclaredInAnonymousClass() throws Exception { } @Test - public void testFieldAccessDeclaredInADefaultClass() throws Exception { + public void testFieldAccessDeclaredInADefaultClass() { final Launcher launcher = new Launcher(); launcher.setArgs(new String[] {"--output-type", "nooutput" }); launcher.addInputResource("./src/test/java/spoon/test/fieldaccesses/testclasses/Tacos.java"); @@ -344,7 +344,7 @@ public void testTypeOfFieldAccess() throws Exception { } @Test - public void testFieldAccessWithoutAnyImport() throws Exception { + public void testFieldAccessWithoutAnyImport() { final Launcher launcher = new Launcher(); launcher.setArgs(new String[] {"--output-type", "nooutput" }); launcher.addInputResource("./src/test/java/spoon/test/fieldaccesses/testclasses/Kuu.java"); @@ -358,7 +358,7 @@ public void testFieldAccessWithoutAnyImport() throws Exception { } @Test - public void testFieldAccessOnUnknownType() throws Exception { + public void testFieldAccessOnUnknownType() { final Launcher launcher = new Launcher(); launcher.addInputResource("./src/test/resources/noclasspath/FieldAccessRes.java"); @@ -384,7 +384,7 @@ public void visitCtFieldWrite(CtFieldWrite fieldWrite) { } @Test - public void testGetReference() throws Exception { + public void testGetReference() { final Launcher launcher = new Launcher(); launcher.getEnvironment().setShouldCompile(true); launcher.setArgs(new String[] {"--output-type", "nooutput" }); diff --git a/src/test/java/spoon/test/prettyprinter/DefaultPrettyPrinterTest.java b/src/test/java/spoon/test/prettyprinter/DefaultPrettyPrinterTest.java index c471747b64b..59b81338437 100644 --- a/src/test/java/spoon/test/prettyprinter/DefaultPrettyPrinterTest.java +++ b/src/test/java/spoon/test/prettyprinter/DefaultPrettyPrinterTest.java @@ -83,7 +83,7 @@ public void superInvocationWithEnclosingInstance() throws Exception { } @Test - public void testPrintAClassWithImports() throws Exception { + public void testPrintAClassWithImports() { final Launcher launcher = new Launcher(); final Factory factory = launcher.getFactory(); factory.getEnvironment().setAutoImports(true); @@ -114,7 +114,7 @@ public void testPrintAClassWithImports() throws Exception { } @Test - public void testPrintAMethodWithImports() throws Exception { + public void testPrintAMethodWithImports() { final Launcher launcher = new Launcher(); final Factory factory = launcher.getFactory(); factory.getEnvironment().setAutoImports(true); @@ -141,7 +141,7 @@ public void testPrintAMethodWithImports() throws Exception { } @Test - public void testPrintAMethodWithGeneric() throws Exception { + public void testPrintAMethodWithGeneric() { final Launcher launcher = new Launcher(); final Factory factory = launcher.getFactory(); factory.getEnvironment().setAutoImports(true); @@ -166,7 +166,7 @@ public void testPrintAMethodWithGeneric() throws Exception { } @Test - public void autoImportUsesFullyQualifiedNameWhenImportedNameAlreadyPresent() throws Exception { + public void autoImportUsesFullyQualifiedNameWhenImportedNameAlreadyPresent() { final Launcher launcher = new Launcher(); final Factory factory = launcher.getFactory(); factory.getEnvironment().setAutoImports(true); diff --git a/src/test/java/spoon/test/reference/ExecutableReferenceGenericTest.java b/src/test/java/spoon/test/reference/ExecutableReferenceGenericTest.java index d65081d4439..d100a6eb7c9 100644 --- a/src/test/java/spoon/test/reference/ExecutableReferenceGenericTest.java +++ b/src/test/java/spoon/test/reference/ExecutableReferenceGenericTest.java @@ -49,7 +49,7 @@ public void setUp() throws Exception { } @Test - public void testReferencesBetweenConstructors() throws Exception { + public void testReferencesBetweenConstructors() { final List> constructors = getConstructorsByClass("MyClass"); CtConstructor emptyConstructor = constructors.get(0); @@ -70,7 +70,7 @@ public void testReferencesBetweenConstructors() throws Exception { } @Test - public void testReferencesBetweenConstructorsInOtherClass() throws Exception { + public void testReferencesBetweenConstructorsInOtherClass() { final List> constructors = getConstructorsByClass("MyClass2"); final CtConstructor ctConstructor = constructors.get(0); final List> refConstructors = getCtConstructorsReferencedInCtConstructor(ctConstructor); @@ -94,7 +94,7 @@ public void testReferencesBetweenConstructorsInOtherClass() throws Exception { } @Test - public void testOneReferenceBetweenMethodsInSameClass() throws Exception { + public void testOneReferenceBetweenMethodsInSameClass() { final CtClass clazz = getCtClassByName("MyClass"); CtMethod method1 = getCtMethodByNameFromCtClass(clazz, "method1"); @@ -106,7 +106,7 @@ public void testOneReferenceBetweenMethodsInSameClass() throws Exception { } @Test - public void testMultiReferenceBetweenMethodsWithGenericInSameClass() throws Exception { + public void testMultiReferenceBetweenMethodsWithGenericInSameClass() { final CtClass clazz = getCtClassByName("MyClass"); CtMethod method2 = getCtMethodByNameFromCtClass(clazz, "method2"); @@ -125,7 +125,7 @@ public void testMultiReferenceBetweenMethodsWithGenericInSameClass() throws Exce } @Test - public void testMultiReferencesBetweenMethodsWithoutGenericInSameClass() throws Exception { + public void testMultiReferencesBetweenMethodsWithoutGenericInSameClass() { final CtClass clazz = getCtClassByName("MyClass"); CtMethod method3 = getCtMethodByNameFromCtClass(clazz, "method3"); @@ -139,7 +139,7 @@ public void testMultiReferencesBetweenMethodsWithoutGenericInSameClass() throws } @Test - public void testMethodWithoutReferences() throws Exception { + public void testMethodWithoutReferences() { final CtClass clazz = getCtClassByName("MyClass"); CtMethod method4 = getCtMethodByNameFromCtClass(clazz, "method4"); @@ -149,7 +149,7 @@ public void testMethodWithoutReferences() throws Exception { } @Test - public void testMethodGenericWithoutReferences() throws Exception { + public void testMethodGenericWithoutReferences() { final CtClass clazz = getCtClassByName("MyClass"); CtMethod method5 = getCtMethodByNameFromCtClass(clazz, "method5"); @@ -159,7 +159,7 @@ public void testMethodGenericWithoutReferences() throws Exception { } @Test - public void testOneReferenceWithGenericMethodOutOfTheClass() throws Exception { + public void testOneReferenceWithGenericMethodOutOfTheClass() { final CtClass clazz = getCtClassByName("MyClass"); final CtClass clazz2 = getCtClassByName("MyClass2"); @@ -176,7 +176,7 @@ public void testOneReferenceWithGenericMethodOutOfTheClass() throws Exception { } @Test - public void testOneReferenceWithMethodNotGenericOutOfTheClass() throws Exception { + public void testOneReferenceWithMethodNotGenericOutOfTheClass() { final CtClass clazz = getCtClassByName("MyClass"); final CtClass clazz2 = getCtClassByName("MyClass2"); @@ -189,7 +189,7 @@ public void testOneReferenceWithMethodNotGenericOutOfTheClass() throws Exception } @Test - public void testMultiReferenceWithGenericMethodOutOfTheClass() throws Exception { + public void testMultiReferenceWithGenericMethodOutOfTheClass() { final CtClass clazz2 = getCtClassByName("MyClass2"); final CtClass clazz3 = getCtClassByName("MyClass3"); @@ -204,7 +204,7 @@ public void testMultiReferenceWithGenericMethodOutOfTheClass() throws Exception } @Test - public void testReferencesBetweenMethods() throws Exception { + public void testReferencesBetweenMethods() { final CtClass clazz2 = getCtClassByName("MyClass2"); CtMethod methodD = getCtMethodByNameFromCtClass(clazz2, "methodD"); @@ -223,7 +223,7 @@ public void testReferencesBetweenMethods() throws Exception { } @Test - public void testExecutableReferences() throws Exception { + public void testExecutableReferences() { // factory has loaded MyClass, MyClass2 and MyClass3 CtClass classMyClass = Query.getElements(factory, new NamedElementFilter<>(CtClass.class,"MyClass")).get(0); diff --git a/src/test/java/spoon/test/reference/ExecutableReferenceTest.java b/src/test/java/spoon/test/reference/ExecutableReferenceTest.java index c1cc070589d..3f0a51cabc8 100644 --- a/src/test/java/spoon/test/reference/ExecutableReferenceTest.java +++ b/src/test/java/spoon/test/reference/ExecutableReferenceTest.java @@ -31,7 +31,7 @@ public class ExecutableReferenceTest { @Test - public void testCallMethodOfClassNotPresent() throws Exception { + public void testCallMethodOfClassNotPresent() { final Launcher launcher = new Launcher(); launcher.run(new String[] { "-i", "./src/test/resources/executable-reference", "--output-type", "nooutput", "--noclasspath" @@ -92,7 +92,7 @@ public boolean matches(CtInvocation element) { } @Test - public void testSuperClassInGetAllExecutables() throws Exception { + public void testSuperClassInGetAllExecutables() { final Launcher launcher = new Launcher(); launcher.addInputResource("./src/test/java/spoon/test/reference/testclasses/"); launcher.setSourceOutputDirectory("./target/spoon-test"); @@ -108,7 +108,7 @@ public void testSuperClassInGetAllExecutables() throws Exception { } @Test - public void testSpecifyGetAllExecutablesMethod() throws Exception { + public void testSpecifyGetAllExecutablesMethod() { final Launcher launcher = new Launcher(); launcher.setArgs(new String[] {"--output-type", "nooutput" }); launcher.addInputResource("./src/test/java/spoon/test/reference/testclasses"); diff --git a/src/test/java/spoon/testing/CtPackageAssertTest.java b/src/test/java/spoon/testing/CtPackageAssertTest.java index 60b31a4e2b6..124ea8055a7 100644 --- a/src/test/java/spoon/testing/CtPackageAssertTest.java +++ b/src/test/java/spoon/testing/CtPackageAssertTest.java @@ -24,7 +24,7 @@ public class CtPackageAssertTest { @Test - public void testEqualityBetweenTwoCtPackage() throws Exception { + public void testEqualityBetweenTwoCtPackage() { //contract: two packages, one made by test code, second made by compilation from sources are equal final Factory factory = createFactory(); final CtPackage aRootPackage = factory.Package().getOrCreate(""); @@ -40,12 +40,12 @@ public void testEqualityBetweenTwoCtPackage() throws Exception { } @Test(expected = AssertionError.class) - public void testEqualityBetweenTwoDifferentCtPackage() throws Exception { + public void testEqualityBetweenTwoDifferentCtPackage() { assertThat(build(new File("./src/test/java/spoon/testing/testclasses/")).Package().getRootPackage()).isEqualTo(createFactory().Package().getOrCreate("another.package")); } @Test(expected = AssertionError.class) - public void testEqualityBetweenTwoCtPackageWithDifferentTypes() throws Exception { + public void testEqualityBetweenTwoCtPackageWithDifferentTypes() { final Factory factory = createFactory(); final CtPackage aRootPackage = factory.Package().getOrCreate(""); factory.Class().create("spoon.testing.testclasses.Foo").addModifier(ModifierKind.PUBLIC); @@ -53,7 +53,7 @@ public void testEqualityBetweenTwoCtPackageWithDifferentTypes() throws Exception } @Test - public void testAddTypeToPackage() throws Exception { + public void testAddTypeToPackage() { final Factory factory = createFactory(); final CtType type = factory.Core().createClass(); type.setSimpleName("X"); diff --git a/src/test/java/spoon/testing/FileAssertTest.java b/src/test/java/spoon/testing/FileAssertTest.java index b1379181731..9625e00b5a4 100644 --- a/src/test/java/spoon/testing/FileAssertTest.java +++ b/src/test/java/spoon/testing/FileAssertTest.java @@ -8,7 +8,7 @@ public class FileAssertTest { public static final String PATH = "./src/test/java/spoon/testing/testclasses/"; @Test - public void testEqualsBetweenTwoSameFile() throws Exception { + public void testEqualsBetweenTwoSameFile() { final String actual = PATH + "Foo.java"; assertThat(actual).isEqualTo(actual); }