@Test
public void testSimpleInheritanceCycleDetection() throws Exception {

  // Nest the classes, so Java doesn't get upset about declaration/reference order.
  @ApiReference(Test1.Test2.class)
  final class Test1 {
    @ApiReference(Test1.class)
    final class Test2 {}
  }
  try {
    ApiConfig config = createConfig(Test1.class);
    annotationReader.loadEndpointClass(serviceContext, Test1.class, config);
    fail();
  } catch (CyclicApiInheritanceException e) {
    // Expected.
  }
}