ClassNotFoundException: org.junit.Assert исключение при использовании MockRestServiceServer - PullRequest
0 голосов
/ 24 декабря 2018

Я пытаюсь запустить следующий тест

  import org.springframework.test.web.client.MockRestServiceServer;
    ....            

@Test
void successPost () {
MockRestServiceServer server = MockRestServiceServer.bindTo(restTemplate).build();

    server.expect(once(), requestTo("http://localhost:8080/test"))
                .andExpect(header("X-AUTH", "myToken"))
                .andRespond(withSuccess("{ \"msg\":\"hi\"}", MediaType.APPLICATION_JSON));

            WebClient<String, DummyResponse> client = new WebClient<>(restTemplate, retryTemplate, DummyResponse.class);
            DummyResponse result = client.post("http://localhost:8080","/test", "myRequest", "myToken");

            // Verify all expectations met
            server.verify();
            assertThat(result.getMsg(), is("hi"));
}

, и это не удается, когда у меня .andExpect(header("X-AUTH", "myToken")) ClassNotFoundException: org.junit.Assert

Проект содержит только зависимости JUnit 5и

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>2.1.0.RELEASE</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
...