-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skip some test method when use jacoco
- Loading branch information
Showing
8 changed files
with
91 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="commit_jacoco_test" type="JUnit" factoryName="JUnit" folderName="git" | ||
singleton="false"> | ||
<extension name="coverage" sample_coverage="false" track_test_folders="true" runner="jacoco"/> | ||
<option name="ALTERNATIVE_JRE_PATH" value="1.8"/> | ||
<option name="PACKAGE_NAME" value=""/> | ||
<option name="MAIN_CLASS_NAME" value=""/> | ||
<option name="METHOD_NAME" value=""/> | ||
<option name="TEST_OBJECT" value="package"/> | ||
<option name="VM_PARAMETERS" | ||
value="-ea -javaagent:$MAVEN_REPOSITORY$/org/jacoco/org.jacoco.agent/0.8.8/org.jacoco.agent-0.8.8-runtime.jar=destfile=$PROJECT_DIR$/litool-test/target/coverage-reports/jacoco.exec "/> | ||
<option name="TEST_SEARCH_SCOPE"> | ||
<value defaultName="wholeProject"/> | ||
</option> | ||
<method v="2"> | ||
<option name="Make" enabled="true"/> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
litool-test/src/main/java/io/leaderli/litool/test/SkipWhenJacocoExecutionCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.leaderli.litool.test; | ||
|
||
import org.junit.jupiter.api.extension.ConditionEvaluationResult; | ||
import org.junit.jupiter.api.extension.ExecutionCondition; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
|
||
public class SkipWhenJacocoExecutionCondition implements ExecutionCondition { | ||
@Override | ||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { | ||
if (LiMock.jacoco) { | ||
return ConditionEvaluationResult.disabled("skip " + context.getRequiredTestMethod().getName() + " when use jacoco"); | ||
} | ||
return ConditionEvaluationResult.enabled(""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
litool-test/src/test/java/io/leaderli/litool/test/Supplier2dAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.leaderli.litool.test; | ||
|
||
import net.bytebuddy.asm.Advice; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
public class Supplier2dAdvice { | ||
@Advice.OnMethodEnter | ||
public static Object enter( | ||
// @Advice.This Object mock, // 静态方法无this | ||
@Advice.Origin Method origin, | ||
@Advice.AllArguments Object[] arguments) { | ||
|
||
return 100; | ||
} | ||
} |