From 5e0d9aaff589340cdff5e1a5a9ddfcd84c58b39d Mon Sep 17 00:00:00 2001 From: Dirk Mahler Date: Thu, 12 Dec 2024 16:01:02 +0100 Subject: [PATCH] #721 renamed concept java:PerformsAssertion to java:MethodPerformsAssertion --- .../impl/report/JUnitReportPluginTest.java | 4 ++-- .../META-INF/jqassistant-rules/java.xml | 16 ++++++++-------- .../plugin/java/test/rules/JavaTestIT.java | 8 ++++---- .../META-INF/jqassistant-rules/junit-common.xml | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugin/common/src/test/java/com/buschmais/jqassistant/plugin/common/impl/report/JUnitReportPluginTest.java b/plugin/common/src/test/java/com/buschmais/jqassistant/plugin/common/impl/report/JUnitReportPluginTest.java index 47c42b5ee7..75e623bdc1 100644 --- a/plugin/common/src/test/java/com/buschmais/jqassistant/plugin/common/impl/report/JUnitReportPluginTest.java +++ b/plugin/common/src/test/java/com/buschmais/jqassistant/plugin/common/impl/report/JUnitReportPluginTest.java @@ -11,7 +11,7 @@ import com.buschmais.jqassistant.core.report.api.model.Column; import com.buschmais.jqassistant.core.report.api.model.Result; import com.buschmais.jqassistant.core.rule.api.model.*; -import com.buschmais.jqassistant.core.shared.xml.JAXBUnmarshaller; +import com.buschmais.jqassistant.core.shared.xml.JAXBHelper; import com.buschmais.jqassistant.plugin.junit.impl.schema.Error; import com.buschmais.jqassistant.plugin.junit.impl.schema.Failure; import com.buschmais.jqassistant.plugin.junit.impl.schema.Testcase; @@ -34,7 +34,7 @@ public class JUnitReportPluginTest extends AbstractReportPluginTest { private static final String EXPECTED_CONTENT = "c = foo\n" + "---\n" + "c = bar\n"; - private JAXBUnmarshaller unmarshaller = new JAXBUnmarshaller(Testsuite.class); + private JAXBHelper unmarshaller = new JAXBHelper(Testsuite.class); private Group testGroup = Group.builder().id("test:Group").description("testGroup").build(); private Concept concept = Concept.builder().id("test:Concept").description("testConcept").severity(Severity.MINOR).build(); diff --git a/plugin/java/src/main/resources/META-INF/jqassistant-rules/java.xml b/plugin/java/src/main/resources/META-INF/jqassistant-rules/java.xml index d2b211eee7..d71eaff1e1 100644 --- a/plugin/java/src/main/resources/META-INF/jqassistant-rules/java.xml +++ b/plugin/java/src/main/resources/META-INF/jqassistant-rules/java.xml @@ -620,20 +620,20 @@ ]]> - + Returns all test methods performing at least one assertion. (testMethod:Method)-[:PERFORMS_ASSERTION]->(assertion:Assert) + (type:Java:Type)-[:DECLARES]->(method:Method)-[:PERFORMS_ASSERTION]->(assertion:Assert) RETURN - type AS DeclaringType, testMethod AS TestMethod + type AS DeclaringType, method AS Method ORDER BY - type.fqn, testMethod.signature + type.fqn, method.signature ]]> - + @@ -645,7 +645,7 @@ MATCH (testClass:Java:Type)-[:DECLARES]->(testMethod:Test:Method) OPTIONAL MATCH - (testMethod)-[invokes:INVOKES|VIRTUAL_INVOKES*]->(assertMethod:Method:Assert), path=shortestPath((testMethod)-[:INVOKES|VIRTUAL_INVOKES*]->(assertMethod)) + path=shortestPath((testMethod)-[:INVOKES|VIRTUAL_INVOKES*]->(assertMethod:Method:Assert)) WITH testClass, testMethod, assertMethod, length(path) as callDepth WHERE @@ -661,7 +661,7 @@ - + @@ -680,7 +680,7 @@ - + All test methods must perform at least one assertion. result = applyConcept("java:PerformsAssertion"); + void javaMethodPerformsAssertion() throws RuleException { + Result result = applyConcept("java:MethodPerformsAssertion"); assertThat(result.getStatus()).isEqualTo(SUCCESS); assertThat(result.getRows()).hasSize(2); Map> annotationAssertion = result.getRows().get(0).getColumns(); Map> methodAssertion = result.getRows().get(1).getColumns(); store.beginTransaction(); assertThat(annotationAssertion.get("DeclaringType").getLabel()).isEqualTo("Test"); - assertThat(annotationAssertion.get("TestMethod").getLabel()).isEqualTo("void annotatedTest()"); + assertThat(annotationAssertion.get("Method").getLabel()).isEqualTo("void annotatedTest()"); assertThat(methodAssertion.get("DeclaringType").getLabel()).isEqualTo("Test"); - assertThat(methodAssertion.get("TestMethod").getLabel()).isEqualTo("void test()"); + assertThat(methodAssertion.get("Method").getLabel()).isEqualTo("void test()"); store.commitTransaction(); } diff --git a/plugin/junit/src/main/resources/META-INF/jqassistant-rules/junit-common.xml b/plugin/junit/src/main/resources/META-INF/jqassistant-rules/junit-common.xml index 658ee8ea04..e69500f640 100644 --- a/plugin/junit/src/main/resources/META-INF/jqassistant-rules/junit-common.xml +++ b/plugin/junit/src/main/resources/META-INF/jqassistant-rules/junit-common.xml @@ -89,7 +89,7 @@ - + All test methods must perform assertions (within a call hierarchy of max. 3 steps). This constraint has been replaced by "java:TestMethodWithoutAssertion".