@Test public void testParseBadInput() { _thrown.expect(IllegalArgumentException.class); _thrown.expectMessage("Error parsing"); ParboiledIpProtocolSpecifier.parse("@.."); }
public static ParboiledIpProtocolSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.IP_PROTOCOL_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.IP_PROTOCOL_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof IpProtocolAstNode, "ParboiledIpProtocolSpecifier requires an IP protocol specifier input"); return new ParboiledIpProtocolSpecifier((IpProtocolAstNode) ast); }
ParboiledIpProtocolSpecifier implements IpProtocolSpecifier { public static ParboiledIpProtocolSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.IP_PROTOCOL_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.IP_PROTOCOL_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof IpProtocolAstNode, "ParboiledIpProtocolSpecifier requires an IP protocol specifier input"); return new ParboiledIpProtocolSpecifier((IpProtocolAstNode) ast); } }
ParboiledIpProtocolSpecifier implements IpProtocolSpecifier { public static ParboiledIpProtocolSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.IP_PROTOCOL_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.IP_PROTOCOL_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof IpProtocolAstNode, "ParboiledIpProtocolSpecifier requires an IP protocol specifier input"); return new ParboiledIpProtocolSpecifier((IpProtocolAstNode) ast); } ParboiledIpProtocolSpecifier(IpProtocolAstNode ast); }
ParboiledIpProtocolSpecifier implements IpProtocolSpecifier { public static ParboiledIpProtocolSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.IP_PROTOCOL_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.IP_PROTOCOL_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof IpProtocolAstNode, "ParboiledIpProtocolSpecifier requires an IP protocol specifier input"); return new ParboiledIpProtocolSpecifier((IpProtocolAstNode) ast); } ParboiledIpProtocolSpecifier(IpProtocolAstNode ast); static ParboiledIpProtocolSpecifier parse(String input); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<IpProtocol> resolve(); }
ParboiledIpProtocolSpecifier implements IpProtocolSpecifier { public static ParboiledIpProtocolSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.IP_PROTOCOL_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.IP_PROTOCOL_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof IpProtocolAstNode, "ParboiledIpProtocolSpecifier requires an IP protocol specifier input"); return new ParboiledIpProtocolSpecifier((IpProtocolAstNode) ast); } ParboiledIpProtocolSpecifier(IpProtocolAstNode ast); static ParboiledIpProtocolSpecifier parse(String input); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<IpProtocol> resolve();  }