/** * Existing interceptor binding, taken from TCK, is annotated @Inherited @Target({TYPE}) If this * test fails, first check that the existing interceptor binding has not been moved or modified. * In the previous version, the result of testNewInterceptorBindingWizard() was used, but that * turned to be not safe, since the order of tests is not guaranteed. * * @throws CoreException */ public void testNewInterceptorBindingWizardWithBinding() throws CoreException { IProject tck = ResourcesPlugin.getWorkspace().getRoot().getProject("tck"); tck.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor()); WizardContext context = new WizardContext(); context.init( "org.jboss.tools.cdi.ui.wizard.NewInterceptorBindingCreationWizard", PACK_NAME, INTERCEPTOR_BINDING2_NAME); try { NewInterceptorBindingWizardPage page = (NewInterceptorBindingWizardPage) context.page; ICDIProject cdi = CDICorePlugin.getCDIProject(context.tck, true); IInterceptorBinding s = cdi.getInterceptorBinding(EXISTING_PACK_NAME + "." + EXISTING_INTERCEPTOR_BINDING_NAME); assertNotNull(s); page.addInterceptorBinding(s); String message = page.getErrorMessage(); assertNull(message); message = page.getMessage(); assertNotNull(message); int messageType = page.getMessageType(); assertEquals(IMessageProvider.WARNING, messageType); String testmessage = NLS.bind( CDIUIMessages.MESSAGE_INTERCEPTOR_BINDING_IS_NOT_COMPATIBLE, s.getSourceType().getElementName()); assertEquals(testmessage, message); page.setTarget("TYPE"); message = page.getErrorMessage(); assertNull(message); message = page.getMessage(); assertNull(message); } finally { context.close(); } }