Skip to content

Commit

Permalink
Refactor the o.s.d.g.listener.StubErrorHandler class.
Browse files Browse the repository at this point in the history
Implement java.lang.Iterable.

Resolves spring-projectsgh-296.
  • Loading branch information
jxblum committed Aug 9, 2021
1 parent ab87f16 commit e0ec118
Showing 1 changed file with 15 additions and 5 deletions.
Expand Up @@ -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 List<Throwable> throwables = new ArrayList<Throwable>();
public class StubErrorHandler implements ErrorHandler, Iterable<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();
}
}

0 comments on commit e0ec118

Please sign in to comment.