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
d39fc5bb
Commit
d39fc5bb
authored
Nov 28, 2013
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up some tests
parent
9db55a3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
SpringApplicationTests.java
...java/org/springframework/boot/SpringApplicationTests.java
+0
-2
AbstractEmbeddedServletContainerFactoryTests.java
...mbedded/AbstractEmbeddedServletContainerFactoryTests.java
+28
-1
No files found.
spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
View file @
d39fc5bb
...
@@ -412,8 +412,6 @@ public class SpringApplicationTests {
...
@@ -412,8 +412,6 @@ public class SpringApplicationTests {
return
false
;
return
false
;
}
}
// FIXME test initializers
public
static
class
SpyApplicationContext
extends
AnnotationConfigApplicationContext
{
public
static
class
SpyApplicationContext
extends
AnnotationConfigApplicationContext
{
ConfigurableApplicationContext
applicationContext
=
spy
(
new
AnnotationConfigApplicationContext
());
ConfigurableApplicationContext
applicationContext
=
spy
(
new
AnnotationConfigApplicationContext
());
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java
View file @
d39fc5bb
...
@@ -27,6 +27,8 @@ import java.util.Date;
...
@@ -27,6 +27,8 @@ import java.util.Date;
import
javax.servlet.ServletContext
;
import
javax.servlet.ServletContext
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletRequest
;
import
javax.servlet.ServletResponse
;
import
org.apache.commons.httpclient.HttpClient
;
import
org.apache.commons.httpclient.HttpClient
;
import
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager
;
import
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager
;
...
@@ -39,6 +41,7 @@ import org.junit.rules.ExpectedException;
...
@@ -39,6 +41,7 @@ import org.junit.rules.ExpectedException;
import
org.junit.rules.TemporaryFolder
;
import
org.junit.rules.TemporaryFolder
;
import
org.mockito.InOrder
;
import
org.mockito.InOrder
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.client.ClientHttpRequest
;
import
org.springframework.http.client.ClientHttpRequest
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
...
@@ -263,7 +266,19 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
...
@@ -263,7 +266,19 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
response
.
close
();
response
.
close
();
}
}
// FIXME test error page
@Test
@Ignore
// FIXME: how to test an error response (maybe java.net.HttpUrlConnection isn't going
// to cut it)
public
void
errorPage
()
throws
Exception
{
ConfigurableEmbeddedServletContainerFactory
factory
=
getFactory
();
factory
.
addErrorPages
(
new
ErrorPage
(
HttpStatus
.
INTERNAL_SERVER_ERROR
,
"/hello"
));
this
.
container
=
factory
.
getEmbeddedServletContainer
(
exampleServletRegistration
(),
errorServletRegistration
());
this
.
container
.
start
();
assertThat
(
getResponse
(
"http://localhost:8080/hello"
),
equalTo
(
"Hello World"
));
assertThat
(
getResponse
(
"http://localhost:8080/bang"
),
equalTo
(
"Hello World"
));
}
protected
String
getResponse
(
String
url
)
throws
IOException
,
URISyntaxException
{
protected
String
getResponse
(
String
url
)
throws
IOException
,
URISyntaxException
{
ClientHttpResponse
response
=
getClientResponse
(
url
);
ClientHttpResponse
response
=
getClientResponse
(
url
);
...
@@ -289,4 +304,16 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
...
@@ -289,4 +304,16 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
private
ServletContextInitializer
exampleServletRegistration
()
{
private
ServletContextInitializer
exampleServletRegistration
()
{
return
new
ServletRegistrationBean
(
new
ExampleServlet
(),
"/hello"
);
return
new
ServletRegistrationBean
(
new
ExampleServlet
(),
"/hello"
);
}
}
private
ServletContextInitializer
errorServletRegistration
()
{
ServletRegistrationBean
bean
=
new
ServletRegistrationBean
(
new
ExampleServlet
()
{
@Override
public
void
service
(
ServletRequest
request
,
ServletResponse
response
)
throws
ServletException
,
IOException
{
throw
new
RuntimeException
(
"Planned"
);
}
},
"/bang"
);
bean
.
setName
(
"error"
);
return
bean
;
}
}
}
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