diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index d4ee7ce931..7648763947 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -22,6 +22,7 @@ https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 3.1.1 RELEASE + 0.8.5 3.11.0 6.13.0 1.8 @@ -79,29 +80,17 @@ ${junit.version} test - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.eclipse.jgit org.eclipse.jgit 5.4.0.201906121030-r test - - org.slf4j - slf4j-simple - 1.7.21 + org.jacoco + org.jacoco.agent + ${maven.jacoco.plugin.version} + runtime test @@ -190,6 +179,11 @@ org.apache.maven.plugins maven-javadoc-plugin 2.10.4 + + + ${java.version} + attach-javadocs @@ -292,35 +286,485 @@ - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - true - - 100 - 100 - 88 - 96 - - .*.checks.coding.CustomDeclarationOrderCheck.*8183 - .*.checks.coding.EitherLogOrThrowCheck8899 - .*.checks.coding.ForbidThrowAnonymousExceptionsCheck8197 - .*.checks.coding.MapIterationInForEachLoopCheck9098 - .*.checks.coding.NoNullForCollectionReturnCheck8596 - .*.checks.coding.OverridableMethodInConstructorCheck9499 - .*.checks.design.HideUtilityClassConstructorCheck96100 - - - + org.jacoco + jacoco-maven-plugin + ${maven.jacoco.plugin.version} - + prepare-agent + + + + default-report + site + + report + + + + default-check + check + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.AvoidModifiersForTypesCheck + com.github.sevntu.checkstyle.checks.coding.CustomDeclarationOrderCheck + com.github.sevntu.checkstyle.checks.coding.CustomDeclarationOrderCheck.ClassDetail + com.github.sevntu.checkstyle.checks.coding.CustomDeclarationOrderCheck.FormatMatcher + com.github.sevntu.checkstyle.checks.coding.EitherLogOrThrowCheck + com.github.sevntu.checkstyle.checks.coding.EmptyPublicCtorInClassCheck + com.github.sevntu.checkstyle.checks.coding.ForbidCertainImportsCheck + com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck + com.github.sevntu.checkstyle.checks.coding.ForbidInstantiationCheck + com.github.sevntu.checkstyle.checks.coding.ForbidThrowAnonymousExceptionsCheck + com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck + com.github.sevntu.checkstyle.checks.coding.MapIterationInForEachLoopCheck + com.github.sevntu.checkstyle.checks.coding.NoNullForCollectionReturnCheck + com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck + com.github.sevntu.checkstyle.checks.coding.OverridableMethodInConstructorCheck + com.github.sevntu.checkstyle.checks.coding.RedundantReturnCheck + com.github.sevntu.checkstyle.checks.coding.RequireFailForTryCatchInJunitCheck + com.github.sevntu.checkstyle.checks.coding.ReturnNullInsteadOfBooleanCheck + com.github.sevntu.checkstyle.checks.design.AvoidConditionInversionCheck + com.github.sevntu.checkstyle.checks.design.CauseParameterInExceptionCheck + com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck + com.github.sevntu.checkstyle.checks.design.HideUtilityClassConstructorCheck + com.github.sevntu.checkstyle.checks.design.PublicReferenceToPrivateTypeCheck + + + + LINE + COVEREDRATIO + 1.00 + + + BRANCH + COVEREDRATIO + 1.00 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.AvoidModifiersForTypesCheck + + + + LINE + COVEREDRATIO + 0.99 + + + BRANCH + COVEREDRATIO + 0.98 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.CustomDeclarationOrderCheck + + + + LINE + COVEREDRATIO + 0.92 + + + BRANCH + COVEREDRATIO + 0.81 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.CustomDeclarationOrderCheck.ClassDetail + + + + LINE + COVEREDRATIO + 0.96 + + + BRANCH + COVEREDRATIO + 0.82 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.CustomDeclarationOrderCheck.FormatMatcher + + + + LINE + COVEREDRATIO + 0.82 + + + BRANCH + COVEREDRATIO + 0.88 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.EitherLogOrThrowCheck + + + + LINE + COVEREDRATIO + 0.99 + + + BRANCH + COVEREDRATIO + 0.88 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.EmptyPublicCtorInClassCheck + + + + LINE + COVEREDRATIO + 0.99 + + + BRANCH + COVEREDRATIO + 0.96 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.ForbidCertainImportsCheck + + + + LINE + COVEREDRATIO + 0.98 + + + BRANCH + COVEREDRATIO + 0.96 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck + + + + LINE + COVEREDRATIO + 0.97 + + + BRANCH + COVEREDRATIO + 0.94 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.ForbidInstantiationCheck + + + + LINE + COVEREDRATIO + 0.98 + + + BRANCH + COVEREDRATIO + 0.97 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.ForbidThrowAnonymousExceptionsCheck + + + + LINE + COVEREDRATIO + 0.97 + + + BRANCH + COVEREDRATIO + 0.81 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck + + + + LINE + COVEREDRATIO + 0.98 + + + BRANCH + COVEREDRATIO + 0.97 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.MapIterationInForEachLoopCheck + + + + LINE + COVEREDRATIO + 0.99 + + + BRANCH + COVEREDRATIO + 0.90 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.NoNullForCollectionReturnCheck + + + + LINE + COVEREDRATIO + 0.96 + + + BRANCH + COVEREDRATIO + 0.86 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck + + + + LINE + COVEREDRATIO + 0.94 + + + BRANCH + COVEREDRATIO + 0.94 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.OverridableMethodInConstructorCheck + + + + LINE + COVEREDRATIO + 0.99 + + + BRANCH + COVEREDRATIO + 0.95 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.RedundantReturnCheck + + + + LINE + COVEREDRATIO + 0.99 + + + BRANCH + COVEREDRATIO + 0.98 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.RequireFailForTryCatchInJunitCheck + + + + LINE + COVEREDRATIO + 0.98 + + + BRANCH + COVEREDRATIO + 0.98 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.coding.ReturnNullInsteadOfBooleanCheck + + + + LINE + COVEREDRATIO + 0.92 + + + BRANCH + COVEREDRATIO + 0.80 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.design.AvoidConditionInversionCheck + + + + LINE + COVEREDRATIO + 0.98 + + + BRANCH + COVEREDRATIO + 0.97 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.design.CauseParameterInExceptionCheck + + + + LINE + COVEREDRATIO + 0.98 + + + BRANCH + COVEREDRATIO + 0.96 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck + + + + LINE + COVEREDRATIO + 0.99 + + + BRANCH + COVEREDRATIO + 0.99 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.design.HideUtilityClassConstructorCheck + + + + LINE + COVEREDRATIO + 1.00 + + + BRANCH + COVEREDRATIO + 0.96 + + + + + CLASS + + com.github.sevntu.checkstyle.checks.design.PublicReferenceToPrivateTypeCheck + + + + LINE + COVEREDRATIO + 0.98 + + + BRANCH + COVEREDRATIO + 0.98 + + + + + @@ -398,7 +842,7 @@ true true true - true + true true diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java index 53a60d4417..9494abe596 100644 --- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java +++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java @@ -20,28 +20,16 @@ package com.github.sevntu.checkstyle.checks.coding; import static com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck.MSG_KEY; -import static org.junit.Assert.fail; import java.io.File; -import org.junit.Assert; import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.reflect.internal.WhiteboxImpl; -import com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck.NumericType; import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; -@RunWith(PowerMockRunner.class) -@PrepareForTest(NumericType.class) public class NumericLiteralNeedsUnderscoreCheckTest extends AbstractModuleTestSupport { - private static final String EXCEPTION_MESSAGE = "Unexpected numeric type "; - private final String warningMessage = getCheckMessage(MSG_KEY); @Override @@ -184,64 +172,4 @@ public void testConfiguredIgnore() throws Exception { .getCanonicalPath(), expected); } - @Test - public void testMinSymbolsBeforeCheckingSwitchReflection() throws Exception { - try { - final NumericLiteralNeedsUnderscoreCheck check = - new NumericLiteralNeedsUnderscoreCheck(); - final NumericType mockType = PowerMockito.mock(NumericType.class); - WhiteboxImpl.invokeMethod(check, "minSymbolsBeforeChecking", mockType); - fail("exception expected"); - } - catch (IllegalStateException ex) { - Assert.assertTrue("Exception's message does not start with: " + EXCEPTION_MESSAGE, - ex.getMessage().startsWith(EXCEPTION_MESSAGE)); - } - } - - @Test - public void testMaxSymbolsUntilUnderscoreSwitchReflection() throws Exception { - try { - final NumericLiteralNeedsUnderscoreCheck check = - new NumericLiteralNeedsUnderscoreCheck(); - final NumericType mockType = PowerMockito.mock(NumericType.class); - WhiteboxImpl.invokeMethod(check, "maxSymbolsUntilUnderscore", mockType); - fail("exception expected"); - } - catch (IllegalStateException ex) { - Assert.assertTrue("Exception's message does not start with: " + EXCEPTION_MESSAGE, - ex.getMessage().startsWith(EXCEPTION_MESSAGE)); - } - } - - @Test - public void testGetNumericSegmentsSwitchReflection() throws Exception { - try { - final NumericLiteralNeedsUnderscoreCheck check = - new NumericLiteralNeedsUnderscoreCheck(); - final NumericType mockType = PowerMockito.mock(NumericType.class); - WhiteboxImpl.invokeMethod(check, "getNumericSegments", "", mockType); - fail("exception expected"); - } - catch (IllegalStateException ex) { - Assert.assertTrue("Exception's message does not start with: " + EXCEPTION_MESSAGE, - ex.getMessage().startsWith(EXCEPTION_MESSAGE)); - } - } - - @Test - public void testRemovePrePostfixByTypeSwitchReflection() throws Exception { - try { - final NumericLiteralNeedsUnderscoreCheck check = - new NumericLiteralNeedsUnderscoreCheck(); - final NumericType mockType = PowerMockito.mock(NumericType.class); - WhiteboxImpl.invokeMethod(check, "removePrePostfixByType", "", mockType); - fail("exception expected"); - } - catch (IllegalStateException ex) { - Assert.assertTrue("Exception's message does not start with: " + EXCEPTION_MESSAGE, - ex.getMessage().startsWith(EXCEPTION_MESSAGE)); - } - } - }