Token { public Optional<ParseState> parse(final Environment environment) { final Environment activeEnvironment = this.encoding != null ? environment.withEncoding(this.encoding) : environment; final Optional<ParseState> result = parseImpl(activeEnvironment.extendScope(name)); environment.callbacks.handle(this, result .map(after -> success(this, environment.parseState, after)) .orElseGet(() -> failure(this, environment.parseState))); return result; } protected  Token(final String name, final Encoding encoding); Optional<ParseState> parse(final Environment environment); boolean isScopeDelimiter(); boolean isLocal(); boolean isIterable(); Token getCanonical(final ParseState parseState); @Override boolean equals(final Object obj); @Override int hashCode(); static final String NO_NAME; static final String SEPARATOR; static final String EMPTY_NAME; final String name; final Encoding encoding; }
@Test public void parseNullParseState() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Argument parseState may not be null."); token.parse(env(null, enc())); }
@Test public void parseNullScope() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Argument scope may not be null."); token.parse(env(null, stream(), enc())); }