private Processor createFailingEventMessageProcessor() { return event -> { throw new DefaultMuleException(mockException); }; }
@Override public CoreEvent process(CoreEvent event) throws MuleException { if (exception instanceof MuleException) { throw (MuleException) exception; } else if (exception instanceof RuntimeException) { throw (RuntimeException) exception; } else { throw new MuleRuntimeException(exception); } }
@Override public synchronized Throwable fillInStackTrace() { if (isVerboseExceptions()) { return super.fillInStackTrace(); } else { return this; } } }
@Before public void setUp() { errorTypeRepository.addErrorType(CONNECTIVITY, errorTypeRepository.getAnyErrorType()); errorTypeRepository.addErrorType(ROUTING, errorTypeRepository.getAnyErrorType()); errorTypeRepository.addErrorType(EXPOSED_ERROR, errorTypeRepository.getAnyErrorType()); errorTypeRepository.addInternalErrorType(INTERNAL_ERROR, errorTypeRepository.getCriticalErrorType()); errorTypeRepository.addInternalErrorType(OTHER_INTERNAL_ERROR, errorTypeRepository.getCriticalErrorType()); }
@Override protected void describeMismatchSafely(TypedException exception, Description mismatchDescription) { mismatchDescription.appendText("is not a TypedException with error "); mismatchDescription.appendValue(exception.getErrorType()); } }
@Override public void after() { super.after(); refreshVerboseExceptions(); } };
private Class<?> getReturnType(String returnClass) { Class<?> returnType = Object.class; if (returnClass != null) { try { returnType = org.apache.commons.lang3.ClassUtils.getClass(returnClass); } catch (ClassNotFoundException e) { throw new MuleRuntimeException(e); } } return returnType; }
private Processor createFailingEventMessageProcessor(Exception toThrow) { return event -> { throw new DefaultMuleException(toThrow); }; }
@Override public synchronized Throwable fillInStackTrace() { if (isVerboseExceptions()) { return super.fillInStackTrace(); } else { return this; } } }
@Override public void before() throws Throwable { super.before(); refreshVerboseExceptions(); }
private void validateLicense() { try { invokeStaticMethod(MuleContainerBootstrap.class, "awaitLicenseValidation"); } catch (NoSuchMethodException e) { return; } catch (Exception e) { throw new MuleRuntimeException(e); } }
@Override public void stop() throws MuleException { try { source.onStop(); } catch (Exception e) { throw new DefaultMuleException(e); } }
@Override public synchronized Throwable fillInStackTrace() { if (isVerboseExceptions()) { return super.fillInStackTrace(); } else { return this; } } }
/** * When running this tests alone, this ensures the environment is consistent with how the tests are run altogether. */ @BeforeClass public static void beforeClass() { refreshVerboseExceptions(); }
public static Object createNewInstance(Class classType) { try { return ClassUtils.instantiateClass(classType); } catch (Exception e) { throw new MuleRuntimeException(e); } }
public static Object createNewInstance(String className) { try { return ClassUtils.instantiateClass(className, new Object[0]); } catch (Exception e) { throw new MuleRuntimeException(e); } }
private Class<? extends Service> resolveContract() { try { return loadClass(contractClassName, FileSystemServiceProviderDiscoverer.class); } catch (Exception e) { throw new MuleRuntimeException(e); } } }
private Class<?> getReturnType() { Class<?> returnType = Object.class; if (returnClass != null) { try { returnType = org.apache.commons.lang3.ClassUtils.getClass(returnClass); } catch (ClassNotFoundException e) { throw new MuleRuntimeException(e); } } return returnType; }
/** * {@inheritDoc} */ @Override public T resolve() { try { return valueResolver.resolve(context); } catch (MuleException e) { throw new MuleRuntimeException(e); } }
@Override protected void doInitialise() { try { initialiseIfNeeded(resolverSet, muleContext); initialiseIfNeeded(connectionProviderResolver, muleContext); } catch (InitialisationException e) { throw new MuleRuntimeException(e); } }