// Path: src/main/java/immanix/matchers/NamedStartElementMatcher.java
// public class NamedStartElementMatcher extends BaseEventMatcher<StartElement> {
//     private final String namespaceURI;
//     private final String name;
// 
//     /**
//      * @param name the start element's name to match
//      */
//     public NamedStartElementMatcher(String name) {
//         this.name = name;
//         this.namespaceURI = null;
//     }
// 
//     /**
//      * @param namespaceURI the start element's namespace uri
//      * @param name         the start element's name to match
//      */
//     public NamedStartElementMatcher(String namespaceURI, String name) {
//         this.name = name;
//         this.namespaceURI = namespaceURI;
//     }
// 
//     @Override
//     protected boolean accept(XMLEvent e) {
//         if (e.isStartElement()) {
//             QName qName = e.asStartElement().getName();
//             return name.equals(qName.getLocalPart()) && (namespaceURI == null || namespaceURI.equals
//                     (qName.getNamespaceURI()));
//         }
//         return false;
//     }
// 
//     @Override
//     protected StartElement process(XMLEvent e) {
//         return e.asStartElement();
//     }
// 
//     @Override
//     protected String expects() {
//         return toString();
//     }
// 
//     @Override
//     public String toString() {
//         return "<" + (namespaceURI == null ? "" : "{" + namespaceURI + "}") + name + ">";
//     }
// 
// }
// 
// 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/XMLEventsUtils.java
// public static XMLEvent c(String val) {
//     return eventFactory.createCharacters(val);
// }
// 
// Path: src/test/java/immanix/utils/XMLEventsUtils.java
// public static XMLEvent se(String name) {
//     return eventFactory.createStartElement(new QName(name), null, null);
// }


import immanix.matchers.NamedStartElementMatcher;
import immanix.readers.ReplayEventReader;
import org.junit.Test;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import java.util.Arrays;
import java.util.List;
import static immanix.utils.XMLEventsUtils.c;
import static immanix.utils.XMLEventsUtils.se;
import static org.junit.Assert.*;
package immanix;




public class NamedStartElementMatcherTest {

    public static final String NS = "http://immanix.net/ns";

    @Test
    public void testSuccessMatchOnLocalPartWithNoNsXml() throws Exception {
        mustSucceed(new NamedStartElementMatcher("42"), Arrays.asList(se("42"), c("hi")));
    }

    @Test
    public void testSuccessMatchOnLocalPartWithNsXml() throws Exception {
        mustSucceed(new NamedStartElementMatcher("42"), Arrays.asList(se(NS, "42"), c("hi")));
    }

    @Test
    public void testSuccessMatchOnLocalPartAndNamespace() throws Exception {
        mustSucceed(new NamedStartElementMatcher(NS, "42"), Arrays.asList(se(NS, "42"), c("hi")));
    }

    @Test
    public void testFailureMatchBecauseOfNameWithNoNsXml() throws Exception {
        mustFail(new NamedStartElementMatcher("elem"), Arrays.<XMLEvent>asList(se("42"), c("chars")));
    }

    @Test
    public void testFailureMatchBecauseOfNameWithNsXml() throws Exception {
        mustFail(new NamedStartElementMatcher("elem"), Arrays.<XMLEvent>asList(se(NS, "42"), c("chars")));
    }

    @Test
    public void testFailureMatchBecauseOfNsWithNoNsXml() throws Exception {
// Path: src/main/java/immanix/matchers/NamedStartElementMatcher.java
// public class NamedStartElementMatcher extends BaseEventMatcher<StartElement> {
//     private final String namespaceURI;
//     private final String name;
// 
//     /**
//      * @param name the start element's name to match
//      */
//     public NamedStartElementMatcher(String name) {
//         this.name = name;
//         this.namespaceURI = null;
//     }
// 
//     /**
//      * @param namespaceURI the start element's namespace uri
//      * @param name         the start element's name to match
//      */
//     public NamedStartElementMatcher(String namespaceURI, String name) {
//         this.name = name;
//         this.namespaceURI = namespaceURI;
//     }
// 
//     @Override
//     protected boolean accept(XMLEvent e) {
//         if (e.isStartElement()) {
//             QName qName = e.asStartElement().getName();
//             return name.equals(qName.getLocalPart()) && (namespaceURI == null || namespaceURI.equals
//                     (qName.getNamespaceURI()));
//         }
//         return false;
//     }
// 
//     @Override
//     protected StartElement process(XMLEvent e) {
//         return e.asStartElement();
//     }
// 
//     @Override
//     protected String expects() {
//         return toString();
//     }
// 
//     @Override
//     public String toString() {
//         return "<" + (namespaceURI == null ? "" : "{" + namespaceURI + "}") + name + ">";
//     }
// 
// }
// 
// 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/XMLEventsUtils.java
// public static XMLEvent c(String val) {
//     return eventFactory.createCharacters(val);
// }
// 
// Path: src/test/java/immanix/utils/XMLEventsUtils.java
// public static XMLEvent se(String name) {
//     return eventFactory.createStartElement(new QName(name), null, null);
// }


// Path: src/test/java/immanix/NamedStartElementMatcherTest.java
import immanix.matchers.NamedStartElementMatcher;
import immanix.readers.ReplayEventReader;
import org.junit.Test;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import java.util.Arrays;
import java.util.List;
import static immanix.utils.XMLEventsUtils.c;
import static immanix.utils.XMLEventsUtils.se;
import static org.junit.Assert.*;

package immanix;




public class NamedStartElementMatcherTest {

    public static final String NS = "http://immanix.net/ns";

    @Test
    public void testSuccessMatchOnLocalPartWithNoNsXml() throws Exception {
        mustSucceed(new NamedStartElementMatcher("42"), Arrays.asList(se("42"), c("hi")));
    }

    @Test
    public void testSuccessMatchOnLocalPartWithNsXml() throws Exception {
        mustSucceed(new NamedStartElementMatcher("42"), Arrays.asList(se(NS, "42"), c("hi")));
    }

    @Test
    public void testSuccessMatchOnLocalPartAndNamespace() throws Exception {
        mustSucceed(new NamedStartElementMatcher(NS, "42"), Arrays.asList(se(NS, "42"), c("hi")));
    }

    @Test
    public void testFailureMatchBecauseOfNameWithNoNsXml() throws Exception {
        mustFail(new NamedStartElementMatcher("elem"), Arrays.<XMLEvent>asList(se("42"), c("chars")));
    }

    @Test
    public void testFailureMatchBecauseOfNameWithNsXml() throws Exception {
        mustFail(new NamedStartElementMatcher("elem"), Arrays.<XMLEvent>asList(se(NS, "42"), c("chars")));
    }

    @Test
    public void testFailureMatchBecauseOfNsWithNoNsXml() throws Exception {
        mustFail(new NamedStartElementMatcher(NS, "elem"), Arrays.<XMLEvent>asList(se("elem"), c("chars")));