org.eclipse.xtext.junit4.InjectWith Java Examples

The following examples show how to use org.eclipse.xtext.junit4.InjectWith. 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: InjectorProviders.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public static IInjectorProvider getOrCreateInjectorProvider(TestClass testClass) {
	InjectWith injectWith = testClass.getJavaClass().getAnnotation(InjectWith.class);
	if (injectWith != null) {
		Class<? extends IInjectorProvider> klass = injectWith.value();
		IInjectorProvider injectorProvider = injectorProviderClassCache.get(klass);
		if (injectorProvider == null) {
			try {
				injectorProvider = klass.getDeclaredConstructor().newInstance();
				injectorProviderClassCache.put(klass, injectorProvider);
			} catch (Exception e) {
				throwUncheckedException(e);
			}
		}
		return injectorProvider;
	}
	return null;
}
 
Example #2
Source File: InjectorProviders.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public static IInjectorProvider getInjectorProvider(TestClass testClass) {
	InjectWith injectWith = testClass.getJavaClass().getAnnotation(InjectWith.class);
	if (injectWith != null) {
		return injectorProviderClassCache.get(injectWith.value());
	}
	return null;
}
 
Example #3
Source File: InjectorProviders.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public static IInjectorProvider createInjectorProvider(TestClass testClass) {
	InjectWith injectWith = testClass.getJavaClass().getAnnotation(InjectWith.class);
	if (injectWith != null) {
		try {
			return injectWith.value().getDeclaredConstructor().newInstance();
		} catch (Exception e) {
			throwUncheckedException(e);
		}
	}
	return null;
}