Skip to content

Commit

Permalink
#721 renamed concept java:PerformsAssertion to java:MethodPerformsAss…
Browse files Browse the repository at this point in the history
…ertion
  • Loading branch information
DirkMahler committed Dec 12, 2024
1 parent 25349e1 commit 5e0d9aa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,7 +34,7 @@ public class JUnitReportPluginTest extends AbstractReportPluginTest {

private static final String EXPECTED_CONTENT = "c = foo\n" + "---\n" + "c = bar\n";

private JAXBUnmarshaller<Testsuite> unmarshaller = new JAXBUnmarshaller(Testsuite.class);
private JAXBHelper<Testsuite> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,20 +620,20 @@
]]></cypher>
</concept>

<concept id="java:PerformsAssertion">
<concept id="java:MethodPerformsAssertion">
<description>Returns all test methods performing at least one assertion.</description>
<cypher><![CDATA[
MATCH
(type:Java:Type)-[:DECLARES]->(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
]]></cypher>
</concept>

<concept id="java:TestMethodPerformsMethodAssertion">
<providesConcept refId="java:PerformsAssertion"/>
<providesConcept refId="java:MethodPerformsAssertion"/>
<requiresConcept refId="java:VirtualInvokes"/>
<requiresConcept refId="java:TestMethod"/>
<requiresConcept refId="java:AssertMethod"/>
Expand All @@ -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
Expand All @@ -661,7 +661,7 @@
</concept>

<concept id="java:TestMethodPerformsAnnotationAssertion">
<providesConcept refId="java:PerformsAssertion"/>
<providesConcept refId="java:MethodPerformsAssertion"/>
<requiresConcept refId="java:TestMethod"/>
<requiresConcept refId="java:AssertAnnotation"/>
<description>
Expand All @@ -680,7 +680,7 @@
</concept>

<constraint id="java:TestMethodWithoutAssertion">
<requiresConcept refId="java:PerformsAssertion"/>
<requiresConcept refId="java:MethodPerformsAssertion"/>
<description>All test methods must perform at least one assertion.</description>
<cypher><![CDATA[
MATCH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ void javaAssertAnnotation() throws RuleException {
}

@Test
void javaPerformsAssertion() throws RuleException {
Result<Concept> result = applyConcept("java:PerformsAssertion");
void javaMethodPerformsAssertion() throws RuleException {
Result<Concept> result = applyConcept("java:MethodPerformsAssertion");
assertThat(result.getStatus()).isEqualTo(SUCCESS);
assertThat(result.getRows()).hasSize(2);
Map<String, Column<?>> annotationAssertion = result.getRows().get(0).getColumns();
Map<String, Column<?>> 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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<constraint id="junit:TestMethodWithoutAssertion">
<requiresConcept refId="java:VirtualInvokes"/>
<requiresConcept refId="java:TestMethod"/>
<requiresConcept refId="java:PerformsAssertion"/>
<requiresConcept refId="java:MethodPerformsAssertion"/>
<description>All test methods must perform assertions (within a call hierarchy of max. 3 steps).</description>
<deprecated>This constraint has been replaced by "java:TestMethodWithoutAssertion".</deprecated>
<cypher><![CDATA[
Expand Down

0 comments on commit 5e0d9aa

Please sign in to comment.