Refactor the o.s.d.g.listener.StubErrorHandler class.
Implement java.lang.Iterable. Resolves gh-296.
This commit is contained in:
@@ -16,20 +16,30 @@
|
||||
package org.springframework.data.gemfire.listener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.ErrorHandler;
|
||||
|
||||
/**
|
||||
* Spring {@link ErrorHandler} for testing.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
* @see org.springframework.util.ErrorHandler
|
||||
*/
|
||||
public class StubErrorHandler implements ErrorHandler {
|
||||
public class StubErrorHandler implements ErrorHandler, Iterable<Throwable> {
|
||||
|
||||
public List<Throwable> throwables = new ArrayList<Throwable>();
|
||||
public final List<Throwable> throwables = new ArrayList<>();
|
||||
|
||||
|
||||
public void handleError(Throwable t) {
|
||||
throwables.add(t);
|
||||
@Override
|
||||
public void handleError(Throwable throwable) {
|
||||
this.throwables.add(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Throwable> iterator() {
|
||||
return Collections.unmodifiableList(this.throwables).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user