DelayedRuleInvocationExpression implements ParsingExpression { @Override public String toString() { if (ruleKey != null) { return ruleKey.toString(); } else { return method.getName() + "()"; } } DelayedRuleInvocationExpression(LexerlessGrammarBuilder b, GrammarRuleKey ruleKey);  DelayedRuleInvocationExpression(LexerlessGrammarBuilder b, GrammarBuilderInterceptor grammarBuilderInterceptor, Method method); @Override Instruction[] compile(CompilationHandler compiler); @Override String toString();  }
@Test public void test_toString() throws Exception { GrammarRuleKey ruleKey = mock(GrammarRuleKey.class); when(ruleKey.toString()).thenReturn("foo"); assertThat(new DelayedRuleInvocationExpression(mock(LexerlessGrammarBuilder.class), ruleKey).toString()).isEqualTo("foo"); Method method = DelayedRuleInvocationExpressionTest.class.getDeclaredMethod("FOO"); assertThat(new DelayedRuleInvocationExpression(mock(LexerlessGrammarBuilder.class), mock(GrammarBuilderInterceptor.class), method).toString()).isEqualTo("FOO()"); }