org.junit.jupiter.api.extension.TestInstances Java Examples
The following examples show how to use
org.junit.jupiter.api.extension.TestInstances.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InjectionExtension.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public void beforeEach(ExtensionContext context) throws Exception { IInjectorProvider injectorProvider = getOrCreateInjectorProvider(context); if (injectorProvider instanceof IRegistryConfigurator) { final IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) injectorProvider; registryConfigurator.setupRegistry(); } if (injectorProvider != null) { Injector injector = injectorProvider.getInjector(); if (injector != null) { Object testInstance = context.getRequiredTestInstance(); injector.injectMembers(testInstance); try { TestInstances requiredTestInstances = context.getRequiredTestInstances(); for (Object o : requiredTestInstances.getEnclosingInstances()) { injector.injectMembers(o); } } catch (NoSuchMethodError e) { if (!Modifier.isStatic(testInstance.getClass().getModifiers())) { if (testInstance.getClass().getDeclaringClass() != null) { throw new ExtensionConfigurationException("Injection of nested classes needs Junit5 >= 5.4", e); } } // OK, getRequiredTestInstances is not there in Junit5 < 5.4 } } } }
Example #2
Source File: MethodBasedExtensionContext.java From enmasse with Apache License 2.0 | 4 votes |
@Override public Optional<TestInstances> getTestInstances() { throw new UnsupportedOperationException("not implemented"); }
Example #3
Source File: BQModuleProviderChecker.java From bootique with Apache License 2.0 | 4 votes |
@Override public Optional<TestInstances> getTestInstances() { return Optional.empty(); }
Example #4
Source File: FakeExtensionContext.java From junit-servers with MIT License | 4 votes |
@Override public Optional<TestInstances> getTestInstances() { throw new UnsupportedOperationException(); }
Example #5
Source File: FakeExtensionContext.java From junit-servers with MIT License | 4 votes |
@Override public Optional<TestInstances> getTestInstances() { throw new UnsupportedOperationException(); }
Example #6
Source File: FakeExtensionContext.java From junit-servers with MIT License | 4 votes |
@Override public Optional<TestInstances> getTestInstances() { throw new UnsupportedOperationException(); }