use of com.google.api.server.spi.config.ApiReference in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testSimpleInheritanceCycleDetection.
@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.
}
}
use of com.google.api.server.spi.config.ApiReference in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testDeepInheritanceCycleDetection.
@Test
public void testDeepInheritanceCycleDetection() throws Exception {
// Nest the classes, so Java doesn't get upset about declaration/reference order.
@ApiReference(Test1.Test2.class)
@Api(name = "Test1")
final class Test1 {
@ApiReference(Test2.Test3.class)
final class Test2 {
@ApiReference(Test3.Test4.class)
@Api(name = "Test3")
final class Test3 {
@ApiReference(Test4.Test5.class)
final class Test4 {
@ApiReference(Test5.Test6.class)
@Api(name = "Test5")
final class Test5 {
@ApiReference(Test6.Test7.class)
final class Test6 {
@ApiReference(Test7.Test8.class)
@Api(name = "Test7")
final class Test7 {
@ApiReference(Test1.class)
final class Test8 {
}
}
}
}
}
}
}
}
try {
ApiConfig config = createConfig(Test1.class);
annotationReader.loadEndpointClass(serviceContext, Test1.class, config);
fail();
} catch (CyclicApiInheritanceException e) {
// Expected.
}
}
Aggregations