// Path: src/main/java/com/almondtools/rexlex/automaton/GenericAutomatonBuilder.java
// public static GenericAutomaton match(char value) {
// 	State s = new State();
// 	State e = new State(DefaultTokenType.ACCEPT);
// 
// 	s.addTransition(new ExactTransition(value, e));
// 	return new GenericAutomaton(s);
// }
// 
// Path: src/main/java/com/almondtools/rexlex/automaton/GenericAutomatonBuilder.java
// public static GenericAutomaton matchOptional(GenericAutomaton a) {
// 	State s = new State(DefaultTokenType.ACCEPT);
// 	s.addTransition(new EpsilonTransition(a.getStart()));
// 	return new GenericAutomaton(s);
// }
// 
// Path: src/test/java/com/almondtools/rexlex/tokens/TestToken.java
// public class TestToken implements Token {
// 
// 	private String literal;
// 	private TokenType type;
// 
// 	public TestToken(String literal, TokenType type) {
// 		this.literal = literal;
// 		this.type = type;
// 	}
// 	
// 	@Override
// 	public String getLiteral() {
// 		return literal;
// 	}
// 	
// 	@Override
// 	public TokenType getType() {
// 		return type;
// 	}
// 	
// 	@Override
// 	public int hashCode() {
// 		return literal.hashCode() * 31 + type.hashCode();
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (obj == null)
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		TestToken other = (TestToken) obj;
// 		return this.type == other.type && this.literal.equals(other.literal);
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		return literal + '(' + type.toString() + ')';
// 	}
// 	
// }
// 
// Path: src/test/java/com/almondtools/rexlex/tokens/TestTokenFactory.java
// public class TestTokenFactory implements TokenFactory<TestToken>{
// 
// 	@Override
// 	public TestToken createToken(String literal, TokenType type) {
// 		return new TestToken(literal, type);
// 	}
// }


import static com.almondtools.rexlex.automaton.GenericAutomatonBuilder.match;
import static com.almondtools.rexlex.automaton.GenericAutomatonBuilder.matchOptional;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.NoSuchElementException;
import org.junit.Test;
import com.almondtools.rexlex.tokens.TestToken;
import com.almondtools.rexlex.tokens.TestTokenFactory;
import net.amygdalum.util.io.StringCharProvider;
		assertThat(tokenIterator.hasNext(), is(true));
	}
	
	@Test
	public void testHasNextWithEmptyMatch() throws Exception {
		TokenIterator<TestToken> tokenIterator = new TokenIterator<TestToken>(matchOptional(match('a')), new StringCharProvider("b", 0), new TestTokenFactory());
		assertThat(tokenIterator.hasNext(), is(true));
	}
	
	@Test
	public void testHasNextWithEmptyMatchOnEmptyChars() throws Exception {
		TokenIterator<TestToken> tokenIterator = new TokenIterator<TestToken>(matchOptional(match('a')), new StringCharProvider("", 0), new TestTokenFactory());
		assertThat(tokenIterator.hasNext(), is(false));
	}
	
	@Test
	public void testHasNextWithAllConsumed() throws Exception {
		TokenIterator<TestToken> tokenIterator = new TokenIterator<TestToken>(match('a'), new StringCharProvider("a", 0), new TestTokenFactory());
		tokenIterator.next();
		assertThat(tokenIterator.hasNext(), is(false));
	}
	
	@Test(expected=NoSuchElementException.class)
	public void testNextOnEmptyChars() throws Exception {
		TokenIterator<TestToken> tokenIterator = new TokenIterator<TestToken>(match('a'), new StringCharProvider("", 0), new TestTokenFactory());
		tokenIterator.next();
	}

	@Test
	public void testNextAndHasNext() throws Exception {
// Path: src/main/java/com/almondtools/rexlex/automaton/GenericAutomatonBuilder.java
// public static GenericAutomaton match(char value) {
// 	State s = new State();
// 	State e = new State(DefaultTokenType.ACCEPT);
// 
// 	s.addTransition(new ExactTransition(value, e));
// 	return new GenericAutomaton(s);
// }
// 
// Path: src/main/java/com/almondtools/rexlex/automaton/GenericAutomatonBuilder.java
// public static GenericAutomaton matchOptional(GenericAutomaton a) {
// 	State s = new State(DefaultTokenType.ACCEPT);
// 	s.addTransition(new EpsilonTransition(a.getStart()));
// 	return new GenericAutomaton(s);
// }
// 
// Path: src/test/java/com/almondtools/rexlex/tokens/TestToken.java
// public class TestToken implements Token {
// 
// 	private String literal;
// 	private TokenType type;
// 
// 	public TestToken(String literal, TokenType type) {
// 		this.literal = literal;
// 		this.type = type;
// 	}
// 	
// 	@Override
// 	public String getLiteral() {
// 		return literal;
// 	}
// 	
// 	@Override
// 	public TokenType getType() {
// 		return type;
// 	}
// 	
// 	@Override
// 	public int hashCode() {
// 		return literal.hashCode() * 31 + type.hashCode();
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (obj == null)
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		TestToken other = (TestToken) obj;
// 		return this.type == other.type && this.literal.equals(other.literal);
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		return literal + '(' + type.toString() + ')';
// 	}
// 	
// }
// 
// Path: src/test/java/com/almondtools/rexlex/tokens/TestTokenFactory.java
// public class TestTokenFactory implements TokenFactory<TestToken>{
// 
// 	@Override
// 	public TestToken createToken(String literal, TokenType type) {
// 		return new TestToken(literal, type);
// 	}
// }


// Path: src/test/java/com/almondtools/rexlex/pattern/TokenIteratorTest.java
import static com.almondtools.rexlex.automaton.GenericAutomatonBuilder.match;
import static com.almondtools.rexlex.automaton.GenericAutomatonBuilder.matchOptional;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.NoSuchElementException;
import org.junit.Test;
import com.almondtools.rexlex.tokens.TestToken;
import com.almondtools.rexlex.tokens.TestTokenFactory;
import net.amygdalum.util.io.StringCharProvider;

		assertThat(tokenIterator.hasNext(), is(true));
	}
	
	@Test
	public void testHasNextWithEmptyMatch() throws Exception {
		TokenIterator<TestToken> tokenIterator = new TokenIterator<TestToken>(matchOptional(match('a')), new StringCharProvider("b", 0), new TestTokenFactory());
		assertThat(tokenIterator.hasNext(), is(true));
	}
	
	@Test
	public void testHasNextWithEmptyMatchOnEmptyChars() throws Exception {
		TokenIterator<TestToken> tokenIterator = new TokenIterator<TestToken>(matchOptional(match('a')), new StringCharProvider("", 0), new TestTokenFactory());
		assertThat(tokenIterator.hasNext(), is(false));
	}
	
	@Test
	public void testHasNextWithAllConsumed() throws Exception {
		TokenIterator<TestToken> tokenIterator = new TokenIterator<TestToken>(match('a'), new StringCharProvider("a", 0), new TestTokenFactory());
		tokenIterator.next();
		assertThat(tokenIterator.hasNext(), is(false));
	}
	
	@Test(expected=NoSuchElementException.class)
	public void testNextOnEmptyChars() throws Exception {
		TokenIterator<TestToken> tokenIterator = new TokenIterator<TestToken>(match('a'), new StringCharProvider("", 0), new TestTokenFactory());
		tokenIterator.next();
	}

	@Test
	public void testNextAndHasNext() throws Exception {
		TokenIterator<TestToken> tokenIterator = new TokenIterator<TestToken>(match('a'), new StringCharProvider("a", 0), new TestTokenFactory());