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
3dcb2d53
Commit
3dcb2d53
authored
Nov 25, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.4.x' into 1.5.x
parents
8757ca77
c6bdd136
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
ResetMocksTestExecutionListener.java
...ot/test/mock/mockito/ResetMocksTestExecutionListener.java
+1
-1
ResetMocksTestExecutionListenerTests.java
...st/mock/mockito/ResetMocksTestExecutionListenerTests.java
+27
-0
No files found.
spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListener.java
View file @
3dcb2d53
...
@@ -65,7 +65,7 @@ public class ResetMocksTestExecutionListener extends AbstractTestExecutionListen
...
@@ -65,7 +65,7 @@ public class ResetMocksTestExecutionListener extends AbstractTestExecutionListen
for
(
String
name
:
names
)
{
for
(
String
name
:
names
)
{
BeanDefinition
definition
=
beanFactory
.
getBeanDefinition
(
name
);
BeanDefinition
definition
=
beanFactory
.
getBeanDefinition
(
name
);
if
(
definition
.
isSingleton
()
&&
instantiatedSingletons
.
contains
(
name
))
{
if
(
definition
.
isSingleton
()
&&
instantiatedSingletons
.
contains
(
name
))
{
Object
bean
=
beanFactory
.
get
Bea
n
(
name
);
Object
bean
=
beanFactory
.
get
Singleto
n
(
name
);
if
(
reset
.
equals
(
MockReset
.
get
(
bean
)))
{
if
(
reset
.
equals
(
MockReset
.
get
(
bean
)))
{
Mockito
.
reset
(
bean
);
Mockito
.
reset
(
bean
);
}
}
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java
View file @
3dcb2d53
...
@@ -21,6 +21,7 @@ import org.junit.Test;
...
@@ -21,6 +21,7 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.MethodSorters
;
import
org.junit.runners.MethodSorters
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.mock.mockito.example.ExampleService
;
import
org.springframework.boot.test.mock.mockito.example.ExampleService
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
...
@@ -37,6 +38,7 @@ import static org.mockito.Mockito.mock;
...
@@ -37,6 +38,7 @@ import static org.mockito.Mockito.mock;
* Tests for {@link ResetMocksTestExecutionListener}.
* Tests for {@link ResetMocksTestExecutionListener}.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Andy Wilkinson
*/
*/
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
...
@@ -94,6 +96,31 @@ public class ResetMocksTestExecutionListenerTests {
...
@@ -94,6 +96,31 @@ public class ResetMocksTestExecutionListenerTests {
throw
new
RuntimeException
();
throw
new
RuntimeException
();
}
}
@Bean
public
BrokenFactoryBean
brokenFactoryBean
()
{
// gh-7270
return
new
BrokenFactoryBean
();
}
}
static
class
BrokenFactoryBean
implements
FactoryBean
<
String
>
{
@Override
public
String
getObject
()
throws
Exception
{
throw
new
IllegalStateException
();
}
@Override
public
Class
<?>
getObjectType
()
{
return
String
.
class
;
}
@Override
public
boolean
isSingleton
()
{
return
true
;
}
}
}
}
}
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