@@ -52,6 +52,15 @@ When using `@MockitoSpyBean` to create a spy for a `FactoryBean`, a spy will be
52
52
for the object created by the `FactoryBean`, not for the `FactoryBean` itself.
53
53
====
54
54
55
+ [NOTE]
56
+ ====
57
+ There are no restrictions on the visibility of `@MockitoBean` and `@MockitoSpyBean`
58
+ fields.
59
+
60
+ Such fields can therefore be `public`, `protected`, package-private (default visibility),
61
+ or `private` depending on the needs or coding practices of the project.
62
+ ====
63
+
55
64
The following example shows how to use the default behavior of the `@MockitoBean` annotation:
56
65
57
66
[tabs]
62
71
----
63
72
class OverrideBeanTests {
64
73
@MockitoBean // <1>
65
- private CustomService customService;
74
+ CustomService customService;
66
75
67
76
// test case body...
68
77
}
86
95
----
87
96
class OverrideBeanTests {
88
97
@MockitoBean("service") // <1>
89
- private CustomService customService;
98
+ CustomService customService;
90
99
91
100
// test case body...
92
101
@@ -107,7 +116,7 @@ Java::
107
116
----
108
117
class OverrideBeanTests {
109
118
@MockitoSpyBean // <1>
110
- private CustomService customService;
119
+ CustomService customService;
111
120
112
121
// test case body...
113
122
}
@@ -130,7 +139,7 @@ Java::
130
139
----
131
140
class OverrideBeanTests {
132
141
@MockitoSpyBean("service") // <1>
133
- private CustomService customService;
142
+ CustomService customService;
134
143
135
144
// test case body...
136
145
0 commit comments