Skip to content

Commit a0dd2f0

Browse files
committed
Remove test dependency on Spring HATEOAS
1 parent 87e9b58 commit a0dd2f0

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

spring-restdocs-mockmvc/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ dependencies {
2121
testImplementation("org.assertj:assertj-core")
2222
testImplementation("org.hamcrest:hamcrest-library")
2323
testImplementation("org.mockito:mockito-core")
24-
testImplementation("org.springframework.hateoas:spring-hateoas")
2524
}
2625

2726
compatibilityTest {

spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRestDocumentationConfigurerTests.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,17 +16,16 @@
1616

1717
package org.springframework.restdocs.mockmvc;
1818

19-
import java.net.URI;
20-
2119
import org.junit.Rule;
2220
import org.junit.Test;
2321

24-
import org.springframework.hateoas.mvc.BasicLinkBuilder;
2522
import org.springframework.mock.web.MockHttpServletRequest;
2623
import org.springframework.restdocs.JUnitRestDocumentation;
2724
import org.springframework.test.web.servlet.request.RequestPostProcessor;
2825
import org.springframework.web.context.request.RequestContextHolder;
2926
import org.springframework.web.context.request.ServletRequestAttributes;
27+
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
28+
import org.springframework.web.util.UriComponents;
3029

3130
import static org.assertj.core.api.Assertions.assertThat;
3231

@@ -89,10 +88,10 @@ private void assertUriConfiguration(String scheme, String host, int port) {
8988
assertThat(port).isEqualTo(this.request.getServerPort());
9089
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(this.request));
9190
try {
92-
URI uri = BasicLinkBuilder.linkToCurrentMapping().toUri();
93-
assertThat(scheme).isEqualTo(uri.getScheme());
94-
assertThat(host).isEqualTo(uri.getHost());
95-
assertThat(port).isEqualTo(uri.getPort());
91+
UriComponents uriComponents = ServletUriComponentsBuilder.fromCurrentServletMapping().build();
92+
assertThat(scheme).isEqualTo(uriComponents.getScheme());
93+
assertThat(host).isEqualTo(uriComponents.getHost());
94+
assertThat(port).isEqualTo(uriComponents.getPort());
9695
}
9796
finally {
9897
RequestContextHolder.resetRequestAttributes();

spring-restdocs-platform/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ dependencies {
2727
api("org.jruby:jruby-complete:9.1.13.0")
2828
api("org.junit.jupiter:junit-jupiter-api:5.0.0")
2929
api("org.mockito:mockito-core:1.10.19")
30-
api("org.springframework.hateoas:spring-hateoas:0.23.0.RELEASE")
3130
api("org.synchronoss.cloud:nio-multipart-parser:1.1.0")
3231
}
3332
api(enforcedPlatform("org.springframework:spring-framework-bom:$springVersion"))

0 commit comments

Comments
 (0)