RedundantListenerException is RuntimeException and sub class of MockitoException. This occurred by Mockito framework when instance of MockitoListener is being added to Mockito Framework and there is already a listener with this implementation type registered.
Note : It is ok to add multiple different implementations of the same listener interface type.
Constructors
- RedundantListenerException(String message) : Will throw exception with message.
Example
MockitoFramework.addListener(MockitoListener);Solutions
If you are trying to add the listener but a listener of the same type was already added (and not removed) this method will throw RedundantListenerException. This is a safeguard to ensure users actually remove the listeners via removeListener. We do not anticipate the use case where adding the same listener type multiple times is useful.
References
Know More
To know more about Junit, Mockito and exception solutions follow below links:
You must log in to post a comment.