Commit 22b73f30 authored by Andy Wilkinson's avatar Andy Wilkinson

Polish "Improve documentaion of Mockito test execution listeners"

See gh-25375
parent 72562e0f
...@@ -6593,7 +6593,7 @@ To use this feature with a different arrangement, listeners must be explicitly a ...@@ -6593,7 +6593,7 @@ To use this feature with a different arrangement, listeners must be explicitly a
[source,java,indent=0] [source,java,indent=0]
---- ----
@TestExecutionListeners({MockitoTestExecutionListener.class, ResetMocksTestExecutionListener.class}) @TestExecutionListeners({ MockitoTestExecutionListener.class, ResetMocksTestExecutionListener.class })
---- ----
==== ====
......
...@@ -33,13 +33,18 @@ import org.springframework.util.ReflectionUtils; ...@@ -33,13 +33,18 @@ import org.springframework.util.ReflectionUtils;
import org.springframework.util.ReflectionUtils.FieldCallback; import org.springframework.util.ReflectionUtils.FieldCallback;
/** /**
* {@link TestExecutionListener} to trigger {@link MockitoAnnotations#initMocks(Object)} * {@link TestExecutionListener} to enable {@link MockBean @MockBean} and
* when {@link MockBean @MockBean} annotations are used. Primarily to allow * {@link SpyBean @SpyBean} support. Also triggers
* {@link Captor @Captor} annotations. * {@link MockitoAnnotations#initMocks(Object)} when any Mockito annotations used,
* primarily to allow {@link Captor @Captor} annotations.
* <p>
* To use the automatic reset support of {@code @MockBean} and {@code @SpyBean}, configure
* {@link ResetMocksTestExecutionListener} as well.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
* @since 1.4.2 * @since 1.4.2
* @see ResetMocksTestExecutionListener
*/ */
public class MockitoTestExecutionListener extends AbstractTestExecutionListener { public class MockitoTestExecutionListener extends AbstractTestExecutionListener {
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -35,10 +35,11 @@ import org.springframework.util.ClassUtils; ...@@ -35,10 +35,11 @@ import org.springframework.util.ClassUtils;
/** /**
* {@link TestExecutionListener} to reset any mock beans that have been marked with a * {@link TestExecutionListener} to reset any mock beans that have been marked with a
* {@link MockReset}. * {@link MockReset}. Typically used alongside {@link MockitoTestExecutionListener}.
* *
* @author Phillip Webb * @author Phillip Webb
* @since 1.4.0 * @since 1.4.0
* @see MockitoTestExecutionListener
*/ */
public class ResetMocksTestExecutionListener extends AbstractTestExecutionListener { public class ResetMocksTestExecutionListener extends AbstractTestExecutionListener {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment