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
5ab072be
Commit
5ab072be
authored
Jun 08, 2016
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
6a291777
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
RestDocsAutoConfigurationAdvancedConfigurationIntegrationTests.java
...toConfigurationAdvancedConfigurationIntegrationTests.java
+3
-1
SpringApplicationTests.java
...java/org/springframework/boot/SpringApplicationTests.java
+11
-8
No files found.
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsAutoConfigurationAdvancedConfigurationIntegrationTests.java
View file @
5ab072be
...
@@ -41,6 +41,8 @@ import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.li
...
@@ -41,6 +41,8 @@ import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.li
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
/**
/**
* Tests for {@link AutoConfigureRestDocs}.
*
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
...
@@ -61,7 +63,7 @@ public class RestDocsAutoConfigurationAdvancedConfigurationIntegrationTests {
...
@@ -61,7 +63,7 @@ public class RestDocsAutoConfigurationAdvancedConfigurationIntegrationTests {
@Test
@Test
public
void
snippetGeneration
()
throws
Exception
{
public
void
snippetGeneration
()
throws
Exception
{
this
.
document
.
snippets
(
links
(
this
.
document
.
document
(
links
(
linkWithRel
(
"self"
).
description
(
"Canonical location of this resource"
)));
linkWithRel
(
"self"
).
description
(
"Canonical location of this resource"
)));
this
.
mvc
.
perform
(
get
(
"/"
));
this
.
mvc
.
perform
(
get
(
"/"
));
File
defaultSnippetsDir
=
new
File
(
File
defaultSnippetsDir
=
new
File
(
...
...
spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
View file @
5ab072be
...
@@ -682,20 +682,17 @@ public class SpringApplicationTests {
...
@@ -682,20 +682,17 @@ public class SpringApplicationTests {
application
.
setApplicationContextClass
(
SpyApplicationContext
.
class
);
application
.
setApplicationContextClass
(
SpyApplicationContext
.
class
);
final
LinkedHashSet
<
ApplicationEvent
>
events
=
new
LinkedHashSet
<
ApplicationEvent
>();
final
LinkedHashSet
<
ApplicationEvent
>
events
=
new
LinkedHashSet
<
ApplicationEvent
>();
application
.
addListeners
(
new
ApplicationListener
<
ApplicationEvent
>()
{
application
.
addListeners
(
new
ApplicationListener
<
ApplicationEvent
>()
{
@Override
@Override
public
void
onApplicationEvent
(
ApplicationEvent
event
)
{
public
void
onApplicationEvent
(
ApplicationEvent
event
)
{
events
.
add
(
event
);
events
.
add
(
event
);
}
}
});
});
this
.
context
=
application
.
run
();
this
.
context
=
application
.
run
();
assertThat
(
events
).
hasAtLeastOneElementOfType
(
ApplicationPreparedEvent
.
class
);
assertThat
(
events
).
hasAtLeastOneElementOfType
(
ApplicationPreparedEvent
.
class
);
assertThat
(
events
).
hasAtLeastOneElementOfType
(
ContextRefreshedEvent
.
class
);
assertThat
(
events
).
hasAtLeastOneElementOfType
(
ContextRefreshedEvent
.
class
);
verifyTestListenerEvents
();
ApplicationListener
<
ApplicationEvent
>
listener
=
this
.
context
.
getBean
(
"testApplicationListener"
,
ApplicationListener
.
class
);
verify
(
listener
).
onApplicationEvent
(
argThat
(
isA
(
ContextRefreshedEvent
.
class
)));
verify
(
listener
).
onApplicationEvent
(
argThat
(
isA
(
ApplicationReadyEvent
.
class
)));
verifyNoMoreInteractions
(
listener
);
}
}
@Test
@Test
...
@@ -705,17 +702,23 @@ public class SpringApplicationTests {
...
@@ -705,17 +702,23 @@ public class SpringApplicationTests {
application
.
setApplicationContextClass
(
SpyApplicationContext
.
class
);
application
.
setApplicationContextClass
(
SpyApplicationContext
.
class
);
final
LinkedHashSet
<
ApplicationEvent
>
events
=
new
LinkedHashSet
<
ApplicationEvent
>();
final
LinkedHashSet
<
ApplicationEvent
>
events
=
new
LinkedHashSet
<
ApplicationEvent
>();
application
.
addListeners
(
new
ApplicationListener
<
ApplicationEvent
>()
{
application
.
addListeners
(
new
ApplicationListener
<
ApplicationEvent
>()
{
@Override
@Override
public
void
onApplicationEvent
(
ApplicationEvent
event
)
{
public
void
onApplicationEvent
(
ApplicationEvent
event
)
{
events
.
add
(
event
);
events
.
add
(
event
);
}
}
});
});
this
.
context
=
application
.
run
();
this
.
context
=
application
.
run
();
assertThat
(
events
).
hasAtLeastOneElementOfType
(
ApplicationPreparedEvent
.
class
);
assertThat
(
events
).
hasAtLeastOneElementOfType
(
ApplicationPreparedEvent
.
class
);
assertThat
(
events
).
hasAtLeastOneElementOfType
(
ContextRefreshedEvent
.
class
);
assertThat
(
events
).
hasAtLeastOneElementOfType
(
ContextRefreshedEvent
.
class
);
verifyTestListenerEvents
();
}
ApplicationListener
<
ApplicationEvent
>
listener
=
this
.
context
.
getBean
(
@SuppressWarnings
(
"unchecked"
)
"testApplicationListener"
,
ApplicationListener
.
class
);
private
void
verifyTestListenerEvents
()
{
ApplicationListener
<
ApplicationEvent
>
listener
=
this
.
context
.
getBean
(
"testApplicationListener"
,
ApplicationListener
.
class
);
verify
(
listener
).
onApplicationEvent
(
argThat
(
isA
(
ContextRefreshedEvent
.
class
)));
verify
(
listener
).
onApplicationEvent
(
argThat
(
isA
(
ContextRefreshedEvent
.
class
)));
verify
(
listener
).
onApplicationEvent
(
argThat
(
isA
(
ApplicationReadyEvent
.
class
)));
verify
(
listener
).
onApplicationEvent
(
argThat
(
isA
(
ApplicationReadyEvent
.
class
)));
verifyNoMoreInteractions
(
listener
);
verifyNoMoreInteractions
(
listener
);
...
...
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