From dcfc7e822de5247feaa1a14f4dcc14dfe84251da Mon Sep 17 00:00:00 2001 From: Matias Fraga Date: Thu, 20 Jun 2019 20:19:39 -0300 Subject: [PATCH] Autoformat --- .../pmd/testframework/RuleTestRunner.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTestRunner.java b/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTestRunner.java index 954eea11e8..299c3823f9 100644 --- a/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTestRunner.java +++ b/pmd-test/src/main/java/net/sourceforge/pmd/testframework/RuleTestRunner.java @@ -28,8 +28,8 @@ import org.junit.runners.model.Statement; import net.sourceforge.pmd.Rule; /** - * A JUnit Runner, that executes all declared rule tests in the class. - * It supports Before and After methods as well as TestRules. + * A JUnit Runner, that executes all declared rule tests in the class. It supports Before and After methods as well as + * TestRules. * * @author Andreas Dangel */ @@ -37,7 +37,7 @@ public class RuleTestRunner extends ParentRunner { private ConcurrentHashMap testDescriptions = new ConcurrentHashMap<>(); private final RuleTst instance; - public RuleTestRunner(Class testClass) throws InitializationError { + /* default */ RuleTestRunner(Class testClass) throws InitializationError { super(testClass); instance = createTestClass(); instance.setUp(); @@ -49,8 +49,8 @@ public class RuleTestRunner extends ParentRunner { if (description == null) { description = Description.createTestDescription(getTestClass().getJavaClass(), testCase.getRule().getName() + "::" - + testCase.getNumberInDocument() + " " - + testCase.getDescription().replaceAll("\n|\r", " ")); + + testCase.getNumberInDocument() + " " + + testCase.getDescription().replaceAll("\n|\r", " ")); testDescriptions.putIfAbsent(testCase, description); } return description; @@ -58,9 +58,10 @@ public class RuleTestRunner extends ParentRunner { /** * Checks whether this test class has additionally unit test methods. + * * @return true if there is at least one unit test method. */ - public boolean hasUnitTests() { + /* default */ boolean hasUnitTests() { return !getTestClass().getAnnotatedMethods(Test.class).isEmpty(); } @@ -97,8 +98,7 @@ public class RuleTestRunner extends ParentRunner { } /** - * Executes the actual test case. If there are Before, After, or TestRules present, - * they are executed accordingly. + * Executes the actual test case. If there are Before, After, or TestRules present, they are executed accordingly. * * @param testCase the PMD rule test case to be executed * @return a single statement which includes any rules, if present. @@ -106,7 +106,7 @@ public class RuleTestRunner extends ParentRunner { private Statement ruleTestBlock(final TestDescriptor testCase) { Statement statement = new Statement() { @Override - public void evaluate() throws Throwable { + public void evaluate() { instance.runTest(testCase); } }; @@ -127,7 +127,8 @@ public class RuleTestRunner extends ParentRunner { } private Statement withRules(final TestDescriptor testCase, Statement statement) { - List testRules = getTestClass().getAnnotatedFieldValues(instance, org.junit.Rule.class, TestRule.class); + List testRules = + getTestClass().getAnnotatedFieldValues(instance, org.junit.Rule.class, TestRule.class); return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(testCase)); }