@Test
public void testClassDef() {

  Parser<Declaration> parser = DeclarationParser.classDef(StatementParser.SYSTEM_MODIFIER, FIELD);
  TerminalParserTest.assertResult(parser, "public final class Foo {}", ClassDef.class, "public final class Foo {}");
  TerminalParserTest.assertResult(parser, "final class Foo<T> {}", ClassDef.class, "final class Foo<T> {}");
  TerminalParserTest.assertResult(parser, "final class Foo<T extends Foo<T>, K> {}",
      ClassDef.class, "final class Foo<T extends Foo<T>, K> {}");
  TerminalParserTest.assertResult(parser, "final class Foo<T extends Foo<T>> extends ArrayList<?> {}",
      ClassDef.class, "final class Foo<T extends Foo<T>> extends ArrayList<?> {}");
  TerminalParserTest.assertResult(parser, "final class Foo<T extends Foo<T>> implements List<?> {}",
      ClassDef.class, "final class Foo<T extends Foo<T>> implements List<?> {}");
  TerminalParserTest.assertResult(parser, "final class Foo<T extends Foo<T>> implements List<?>, Iterable<T> {}",
      ClassDef.class, "final class Foo<T extends Foo<T>> implements List<?>, Iterable<T> {}");
  TerminalParserTest.assertResult(parser, "final class Foo<T extends Foo<T>> {public static final String S = foo;}",
      ClassDef.class, "final class Foo<T extends Foo<T>> {public static final String S = foo;}");
  TerminalParserTest.assertResult(parser, "final class Foo<T extends Foo<T>> {int i; int j;}",
      ClassDef.class, "final class Foo<T extends Foo<T>> {int i; int j;}");
}