}
@Test(expected=IllegalStateException.class)
public void testInstallationWithCyclicRequirements() {
// page extension construction
PageExtension pageExtensionMock = Mockito.mock(PageExtension.class);
when(pageExtensionMock.getExtensionScript()).thenReturn(JavaScript.fromString("document.Graphene2 = document.Graphene1 + 1;"));
when(pageExtensionMock.getInstallationDetectionScript()).thenReturn(JavaScript.fromString("return ((typeof document.Graphene2 != 'undefined') && document.Graphene2 == 2);"));
List<String> requirements = new ArrayList<String>();
requirements.add(SimplePageExtension.class.getName());
requirements.add(CyclicPageExtension1.class.getName());
requirements.add(CyclicPageExtension2.class.getName());
when(pageExtensionMock.getRequired()).thenReturn(requirements);
// registry
PageExtensionRegistry registry = context().getPageExtensionRegistry();
registry.register(new SimplePageExtension());
registry.register(pageExtensionMock);
registry.register(new CyclicPageExtension1());
registry.register(new CyclicPageExtension2());
// test
context().getPageExtensionInstallatorProvider().installator(pageExtensionMock.getName()).install();
}