Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
d31dbac6
Commit
d31dbac6
authored
May 18, 2018
by
Mihhail Lapushkin
Committed by
Stephane Nicoll
May 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support custom UriTemplateHandler in LocalHostUriTemplateHandler
See gh-13208
parent
48cf0250
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
LocalHostUriTemplateHandler.java
...ork/boot/test/web/client/LocalHostUriTemplateHandler.java
+15
-1
LocalHostUriTemplateHandlerTests.java
...oot/test/web/client/LocalHostUriTemplateHandlerTests.java
+7
-0
No files found.
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandler.java
View file @
d31dbac6
...
...
@@ -58,9 +58,23 @@ public class LocalHostUriTemplateHandler extends RootUriTemplateHandler {
* @since 1.4.1
*/
public
LocalHostUriTemplateHandler
(
Environment
environment
,
String
scheme
)
{
super
(
new
DefaultUriBuilderFactory
());
this
(
environment
,
scheme
,
new
DefaultUriBuilderFactory
());
}
/**
* Create a new {@code LocalHostUriTemplateHandler} that will generate URIs with the
* given {@code scheme}, use the given {@code environment} to determine the
* context-path and port and delegate to the given template {@code handler}.
* @param environment the environment used to determine the port
* @param scheme the scheme of the root uri
* @param handler the delegate handler
* @since 2.0.3
*/
public
LocalHostUriTemplateHandler
(
Environment
environment
,
String
scheme
,
UriTemplateHandler
handler
)
{
super
(
handler
);
Assert
.
notNull
(
environment
,
"Environment must not be null"
);
Assert
.
notNull
(
scheme
,
"Scheme must not be null"
);
Assert
.
notNull
(
handler
,
"Handler must not be null"
);
this
.
environment
=
environment
;
this
.
scheme
=
scheme
;
}
...
...
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandlerTests.java
View file @
d31dbac6
...
...
@@ -50,6 +50,13 @@ public class LocalHostUriTemplateHandlerTests {
new
LocalHostUriTemplateHandler
(
new
MockEnvironment
(),
null
);
}
@Test
public
void
createWhenHandlerIsNullShouldThrowException
()
{
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"Handler must not be null"
);
new
LocalHostUriTemplateHandler
(
new
MockEnvironment
(),
"http"
,
null
);
}
@Test
public
void
getRootUriShouldUseLocalServerPort
()
{
MockEnvironment
environment
=
new
MockEnvironment
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment