diff --git a/src/main/resources/META-INF/jqassistant-rules/assertj.xml b/src/main/resources/META-INF/jqassistant-rules/assertj.xml index 68e2ddd..97a1e27 100644 --- a/src/main/resources/META-INF/jqassistant-rules/assertj.xml +++ b/src/main/resources/META-INF/jqassistant-rules/assertj.xml @@ -12,11 +12,16 @@ (assertType:Type)-[:DECLARES]->(assertMethod) WHERE assertType.fqn =~ 'org\\.assertj\\.core\\.api\\..*Assertions.*' - AND assertMethod.signature =~ '.* assert.*' + AND ( + assertMethod.signature =~ '.* assert.*' OR + assertMethod.signature =~ '.* fail.*' + ) SET assertMethod:AssertJ:Assert RETURN assertMethod + ORDER BY + assertMethod.signature ]]> diff --git a/src/test/java/org/jqassistant/plugin/java_testing/concept/AssertExample.java b/src/test/java/org/jqassistant/plugin/java_testing/concept/AssertExample.java index 49f31a1..c457af6 100644 --- a/src/test/java/org/jqassistant/plugin/java_testing/concept/AssertExample.java +++ b/src/test/java/org/jqassistant/plugin/java_testing/concept/AssertExample.java @@ -20,6 +20,8 @@ void assertjAssertExampleMethod() { Assertions.assertThat(true).isTrue(); } + void assertjFailExampleMethod() { Assertions.fail("fail"); } + void xmlAssertExampleMethod() { XmlAssert.assertThat("").and("").normalizeWhitespace().areSimilar(); } diff --git a/src/test/java/org/jqassistant/plugin/java_testing/concept/AssertJIT.java b/src/test/java/org/jqassistant/plugin/java_testing/concept/AssertJIT.java index 0761ac1..7695457 100644 --- a/src/test/java/org/jqassistant/plugin/java_testing/concept/AssertJIT.java +++ b/src/test/java/org/jqassistant/plugin/java_testing/concept/AssertJIT.java @@ -31,12 +31,18 @@ void assertjAssertMethod() throws Exception { store.beginTransaction(); - assertThat(conceptResult.getRows().size()).isEqualTo(1); + assertThat(conceptResult.getRows().size()).isEqualTo(2); assertThat(conceptResult.getRows() .get(0) .getColumns() .get("assertMethod") .getValue()).asInstanceOf(type(MethodDescriptor.class)) + .is(methodDescriptor(Assertions.class, "fail", String.class)); + assertThat(conceptResult.getRows() + .get(1) + .getColumns() + .get("assertMethod") + .getValue()).asInstanceOf(type(MethodDescriptor.class)) .is(methodDescriptor(Assertions.class, "assertThat", boolean.class)); verifyResultGraph(); @@ -74,8 +80,12 @@ private void verifyResultGraph() throws NoSuchMethodException { + "RETURN testMethod, assertMethod"); assertThat(methodQueryResult.getColumn("testMethod")) .haveExactly(1, methodDescriptor(AssertExample.class, "assertjAssertExampleMethod")); + assertThat(methodQueryResult.getColumn("testMethod")) + .haveExactly(1, methodDescriptor(AssertExample.class, "assertjFailExampleMethod")); assertThat(methodQueryResult.getColumn("assertMethod")) .haveExactly(1, methodDescriptor(Assertions.class, "assertThat", boolean.class)); + assertThat(methodQueryResult.getColumn("assertMethod")) + .haveExactly(1, methodDescriptor(Assertions.class, "fail", String.class)); } }