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.
- RedundantListenerException(String message) : Will throw exception with message.
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</strong>. We do not anticipate the use case where adding the same listener type multiple times is useful.
To know more about Junit, Mockito and exception solutions follow below links: