@Test
public void testProgram() {

  Parser<Program> parser = DeclarationParser.program();
  TerminalParserTest.assertResult(parser, "package foo; import foo.bar.*; class Foo {int[] a = {1}; Foo(){}}",
      Program.class, "package foo; import foo.bar.*; class Foo {int[] a = {1}; Foo() {}}");
  TerminalParserTest.assertResult(parser, "class Foo {{} static {}}",
      Program.class, "class Foo {{} static {}}");
  TerminalParserTest.assertResult(parser, "package foo; import foo.bar.*; enum Foo {}",
      Program.class, "package foo; import foo.bar.*; enum Foo {}");
  TerminalParserTest.assertResult(parser, "enum Foo {;static {1;} static {2;} {3;} {4;}}",
      Program.class, "enum Foo {; static {1;} static {2;} {3;} {4;}}");
  TerminalParserTest.assertResult(parser, "package foo; import foo.bar.*; interface Foo {int i = 1;}",
      Program.class, "package foo; import foo.bar.*; interface Foo {int i = 1;}");
  TerminalParserTest.assertResult(parser, "package foo; import foo.bar.*; @interface Foo {int[] value() default {1};}",
      Program.class, "package foo; import foo.bar.*; @interface Foo {int[] value() default {1};}");
  TerminalParserTest.assertResult(parser, "import foo.bar.*; class Foo<T> implements Bar {} interface Bar {}",
      Program.class, "import foo.bar.*; class Foo<T> implements Bar {} interface Bar {}");
  TerminalParserTest.assertResult(parser, "class Foo {class Bar {}}",
      Program.class, "class Foo {class Bar {}}");
  TerminalParserTest.assertResult(parser, "class Foo {private static final class Bar {}}",
      Program.class, "class Foo {private static final class Bar {}}");
  TerminalParserTest.assertResult(parser, "class Foo {enum Bar {B}}",
      Program.class, "class Foo {enum Bar {B}}");
  TerminalParserTest.assertResult(parser, "class Foo {@interface Bar {;;}}",
      Program.class, "class Foo {@interface Bar {}}");
}