Example usage for org.aspectj.bridge AbortException AbortException

List of usage examples for org.aspectj.bridge AbortException AbortException

Introduction

In this page you can find the example usage for org.aspectj.bridge AbortException AbortException.

Prototype

public AbortException(IMessage message) 

Source Link

Document

abort with structured message

Usage

From source file:org.eclipse.ajdt.ui.tests.ajde.UIMessageHandlerTest.java

License:Open Source License

/**
 * For an error with a throwable we expect an error dialog to appear
 * containing the information//from w w w  .j a  v  a2s. co m
 */
public void testHandleErrorWithMessageAndThrowable() throws Exception {
    IProject project = createPredefinedProject("Bean Example"); //$NON-NLS-1$
    AJDTErrorHandler.setShowErrorDialogs(false);
    String message = ""; //$NON-NLS-1$
    try {
        IBuildMessageHandler handler = AspectJPlugin.getDefault().getCompilerFactory()
                .getCompilerForProject(project).getMessageHandler();

        IMessage msg = new Message("fake error", IMessage.ERROR, new AbortException("fake abort"), null); //$NON-NLS-1$ //$NON-NLS-2$
        handler.handleMessage(msg);
    } catch (RuntimeException re) {
        message = re.getMessage();
    }
    assertTrue("expected a runtime error with message 'fake abort' when " + //$NON-NLS-1$
            " testing error handling but didn't find one", //$NON-NLS-1$
            message.equals("org.aspectj.bridge.AbortException: fake abort")); //$NON-NLS-1$
}

From source file:org.eclipse.ajdt.ui.tests.ajde.UIMessageHandlerTest.java

License:Open Source License

/**
 * For an abort message we expect an error dialog to appear containing the
 * information/*  w  ww.  j av  a  2s . co m*/
 */
public void testHandleAbortWithMessageAndThrowable() throws Exception {
    IProject project = createPredefinedProject("Bean Example"); //$NON-NLS-1$
    AJDTErrorHandler.setShowErrorDialogs(false);
    String message = ""; //$NON-NLS-1$
    try {
        IBuildMessageHandler handler = AspectJPlugin.getDefault().getCompilerFactory()
                .getCompilerForProject(project).getMessageHandler();

        IMessage msg = new Message("fake abort", IMessage.ABORT, new AbortException("fake abort"), null); //$NON-NLS-1$ //$NON-NLS-2$
        handler.handleMessage(msg);
    } catch (RuntimeException re) {
        message = re.getMessage();
    }
    assertTrue("expected a runtime error with message 'fake abort' when " + //$NON-NLS-1$
            " testing error handling but didn't find one", //$NON-NLS-1$
            message.equals("org.aspectj.bridge.AbortException: fake abort")); //$NON-NLS-1$
}