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
c903f874
Commit
c903f874
authored
Sep 29, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
bcdc6958
663cae12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
MockBean.java
.../org/springframework/boot/test/mock/mockito/MockBean.java
+7
-3
SpyBean.java
...a/org/springframework/boot/test/mock/mockito/SpyBean.java
+6
-2
No files found.
spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockBean.java
View file @
c903f874
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -37,8 +37,12 @@ import org.springframework.test.context.junit4.SpringRunner;
* or test classes that are {@link RunWith @RunWith} the {@link SpringRunner}.
* <p>
* Mocks can be registered by type or by {@link #name() bean name}. Any existing single
* bean of the same type defined in the context will be replaced by the mock, if no
* existing bean is defined a new one will be added.
* bean of the same type defined in the context will be replaced by the mock. If no
* existing bean is defined a new one will be added. Dependencies that are known to the
* application context but are not beans (such as those
* {@link org.springframework.beans.factory.config.ConfigurableListableBeanFactory#registerResolvableDependency(Class, Object)
* registered directly} ) will not be found and a mocked bean will be added to the context
* alongside the existing dependency.
* <p>
* When {@code @MockBean} is used on a field, as well as being registered in the
* application context, the mock will also be injected into the field. Typical usage might
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyBean.java
View file @
c903f874
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -38,7 +38,11 @@ import org.springframework.test.context.junit4.SpringRunner;
* <p>
* Spies can be applied by type or by {@link #name() bean name}. All beans in the context
* of the same type will be wrapped with the spy. If no existing bean is defined a new one
* will be added.
* will be added. Dependencies that are known to the application context but are not beans
* (such as those
* {@link org.springframework.beans.factory.config.ConfigurableListableBeanFactory#registerResolvableDependency(Class, Object)
* registered directly} ) will not be found and a spied bean will be added to the context
* alongside the existing dependency.
* <p>
* When {@code @SpyBean} is used on a field, as well as being registered in the
* application context, the spy will also be injected into the field. Typical usage might
...
...
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