// Path: src/main/java/immanix/matchers/CondMatcher.java
// public abstract class CondMatcher<T> extends StaxMatcher<T> {
//     private final StaxMatcher<T> delegate;
// 
//     public CondMatcher(StaxMatcher<T> delegate) {
//         this.delegate = delegate;
//     }
// 
//     @Override
//     public MatcherResult<T> match(EventReader reader) throws XMLStreamException {
//         MatcherResult<T> res = delegate.match(reader);
//         if (res.isFailure()) {
//             return res;
//         } else {
//             if (validate(res.data)) {
//                 return res;
//             } else {
//                 return MatcherResult.failure(new BacktrackEventReader(res.consumedEvents, res.reader.unwrap()),
//                         toString() + " failed as the delegate matcher's '" + delegate.toString() +
//                                 "' result didn't satisfy the condition '" + conditionInEnglish() +
//                                 "'");
//             }
//         }
//     }
// 
//     /**
//      * @param data the delgate matcher's result
//      * @return whether to accept this result or not
//      */
//     public abstract boolean validate(T data);
// 
//     public abstract String conditionInEnglish();
// 
//     @Override
//     public String toString() {
//         return "(cond " + delegate + ")";
//     }
// }
// 
// Path: src/main/java/immanix/readers/ReplayEventReader.java
// @SuppressWarnings("restriction")
// public class ReplayEventReader implements EventReader {
// 
//     private Iterator<? extends XMLEvent> events;
// 
//     public ReplayEventReader(List<? extends XMLEvent> events) {
//         super();
//         this.events = new ArrayList(events).iterator();
//     }
// 
//     public boolean hasNext() {
//         return events.hasNext();
//     }
// 
//     public XMLEvent next() throws XMLStreamException {
//         return events.next();
//     }
// 
//     public EventReader unwrap() {
//         return this;
//     }
// 
//     @Override
//     public String toString() {
//         return "Replayer";
//     }
// }
// 
// Path: src/test/java/immanix/utils/HungryPacman.java
// public class HungryPacman extends StaxMatcher<Object> {
//     int count;
// 
//     public HungryPacman(int count) {
//         this.count = count;
//     }
// 
//     @Override
//     public MatcherResult<Object> match(EventReader reader) throws XMLStreamException {
//         if (count-- > 0) {
//             return MatcherResult.<Object>success("S", reader, Arrays.asList(reader.next()));
//         } else {
//             return MatcherResult.failure(reader, "Pacman is full");
//         }
//     }
// }
// 
// Path: src/test/java/immanix/utils/XMLEventsUtils.java
// public static XMLEvent c(String val) {
//     return eventFactory.createCharacters(val);
// }


import immanix.matchers.CondMatcher;
import immanix.readers.ReplayEventReader;
import immanix.utils.HungryPacman;
import org.junit.Test;
import javax.xml.stream.events.XMLEvent;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static immanix.utils.XMLEventsUtils.c;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
package immanix;




public class CondMatcherTest {

    @Test
    public void testDelegateMatcherIsCalled() throws Exception {
        List<XMLEvent> events = Arrays.<XMLEvent>asList();
// Path: src/main/java/immanix/matchers/CondMatcher.java
// public abstract class CondMatcher<T> extends StaxMatcher<T> {
//     private final StaxMatcher<T> delegate;
// 
//     public CondMatcher(StaxMatcher<T> delegate) {
//         this.delegate = delegate;
//     }
// 
//     @Override
//     public MatcherResult<T> match(EventReader reader) throws XMLStreamException {
//         MatcherResult<T> res = delegate.match(reader);
//         if (res.isFailure()) {
//             return res;
//         } else {
//             if (validate(res.data)) {
//                 return res;
//             } else {
//                 return MatcherResult.failure(new BacktrackEventReader(res.consumedEvents, res.reader.unwrap()),
//                         toString() + " failed as the delegate matcher's '" + delegate.toString() +
//                                 "' result didn't satisfy the condition '" + conditionInEnglish() +
//                                 "'");
//             }
//         }
//     }
// 
//     /**
//      * @param data the delgate matcher's result
//      * @return whether to accept this result or not
//      */
//     public abstract boolean validate(T data);
// 
//     public abstract String conditionInEnglish();
// 
//     @Override
//     public String toString() {
//         return "(cond " + delegate + ")";
//     }
// }
// 
// Path: src/main/java/immanix/readers/ReplayEventReader.java
// @SuppressWarnings("restriction")
// public class ReplayEventReader implements EventReader {
// 
//     private Iterator<? extends XMLEvent> events;
// 
//     public ReplayEventReader(List<? extends XMLEvent> events) {
//         super();
//         this.events = new ArrayList(events).iterator();
//     }
// 
//     public boolean hasNext() {
//         return events.hasNext();
//     }
// 
//     public XMLEvent next() throws XMLStreamException {
//         return events.next();
//     }
// 
//     public EventReader unwrap() {
//         return this;
//     }
// 
//     @Override
//     public String toString() {
//         return "Replayer";
//     }
// }
// 
// Path: src/test/java/immanix/utils/HungryPacman.java
// public class HungryPacman extends StaxMatcher<Object> {
//     int count;
// 
//     public HungryPacman(int count) {
//         this.count = count;
//     }
// 
//     @Override
//     public MatcherResult<Object> match(EventReader reader) throws XMLStreamException {
//         if (count-- > 0) {
//             return MatcherResult.<Object>success("S", reader, Arrays.asList(reader.next()));
//         } else {
//             return MatcherResult.failure(reader, "Pacman is full");
//         }
//     }
// }
// 
// Path: src/test/java/immanix/utils/XMLEventsUtils.java
// public static XMLEvent c(String val) {
//     return eventFactory.createCharacters(val);
// }


// Path: src/test/java/immanix/CondMatcherTest.java
import immanix.matchers.CondMatcher;
import immanix.readers.ReplayEventReader;
import immanix.utils.HungryPacman;
import org.junit.Test;
import javax.xml.stream.events.XMLEvent;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static immanix.utils.XMLEventsUtils.c;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

package immanix;




public class CondMatcherTest {

    @Test
    public void testDelegateMatcherIsCalled() throws Exception {
        List<XMLEvent> events = Arrays.<XMLEvent>asList();
        ReplayEventReader reader = new ReplayEventReader(events);