Add value attribute alias to @MockitoBean and @MockitoSpyBean
This commit improves the user experience for common use cases by
introducing new `value` attributes in @MockitoBean and
@MockitoSpyBean that are aliases for the existing `name` attributes.
For example, this allows developers to declare
@MockitoBean("userService") instead of @MockitoBean(name =
"userService"), analogous to the existing name/value alias support in
@TestBean.
Closes gh-33680
This commit is contained in:
@@ -77,7 +77,7 @@ Java::
|
||||
[source,java,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
class OverrideBeanTests {
|
||||
@MockitoBean(name = "service") // <1>
|
||||
@MockitoBean("service") // <1>
|
||||
private CustomService customService;
|
||||
|
||||
// test case body...
|
||||
@@ -121,7 +121,7 @@ Java::
|
||||
[source,java,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
class OverrideBeanTests {
|
||||
@MockitoSpyBean(name = "service") // <1>
|
||||
@MockitoSpyBean("service") // <1>
|
||||
private CustomService customService;
|
||||
|
||||
// test case body...
|
||||
|
||||
Reference in New Issue
Block a user