diff --git a/java-checks-test-sources/default/pom.xml b/java-checks-test-sources/default/pom.xml index 928f76334b5..62462cbcc4c 100644 --- a/java-checks-test-sources/default/pom.xml +++ b/java-checks-test-sources/default/pom.xml @@ -304,6 +304,12 @@ 4.1.2.RELEASE provided + + org.springframework.ws + spring-ws-test + 4.0.7 + provided + org.springframework.boot spring-boot diff --git a/java-checks-test-sources/default/src/test/java/checks/tests/AssertionsInTestsCheck/Spring.java b/java-checks-test-sources/default/src/test/java/checks/tests/AssertionsInTestsCheck/Spring.java index 1bd8687b346..246337d86e3 100644 --- a/java-checks-test-sources/default/src/test/java/checks/tests/AssertionsInTestsCheck/Spring.java +++ b/java-checks-test-sources/default/src/test/java/checks/tests/AssertionsInTestsCheck/Spring.java @@ -4,6 +4,7 @@ import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.ResultHandler; import org.springframework.test.web.servlet.ResultMatcher; +import org.springframework.ws.test.server.MockWebServiceClient; class SpringTest { @@ -35,6 +36,14 @@ public void fakeTest2() throws Exception { // Compliant public void andExpectAllTest() throws Exception { // Compliant getResultActions().andDo(getResultHandler()).andExpectAll(getResultMatcher(), getResultMatcher()).andReturn(); } + + @Test + public void mockWebServiceClient(){ // Compliant + MockWebServiceClient server = null; + server.sendRequest(null) + .andExpect(null) + .andExpect(null); + } private ResultActions getResultActions() { return null; diff --git a/java-checks/src/main/java/org/sonar/java/checks/helpers/UnitTestUtils.java b/java-checks/src/main/java/org/sonar/java/checks/helpers/UnitTestUtils.java index fd64c2219da..cc26783b0d1 100644 --- a/java-checks/src/main/java/org/sonar/java/checks/helpers/UnitTestUtils.java +++ b/java-checks/src/main/java/org/sonar/java/checks/helpers/UnitTestUtils.java @@ -39,7 +39,7 @@ public final class UnitTestUtils { private static final String ORG_JUNIT_TEST = "org.junit.Test"; - public static final Pattern ASSERTION_METHODS_PATTERN = Pattern.compile("(assert|verify|fail|should|check|expect|validate).*"); + public static final Pattern ASSERTION_METHODS_PATTERN = Pattern.compile("(assert|verify|fail|should|check|expect|validate|andExpect).*"); public static final Pattern TEST_METHODS_PATTERN = Pattern.compile("test.*|.*Test"); public static final MethodMatchers ASSERTION_INVOCATION_MATCHERS = MethodMatchers.or(