Example usage for java.rmi AccessException AccessException

List of usage examples for java.rmi AccessException AccessException

Introduction

In this page you can find the example usage for java.rmi AccessException AccessException.

Prototype

public AccessException(String s, Exception ex) 

Source Link

Document

Constructs an AccessException with the specified detail message and nested exception.

Usage

From source file:org.slc.sli.ingestion.util.LogUtilTest.java

@Test
public void testLogUtil() {
    // Log a nested exception.
    final Logger mockLogger = Mockito.mock(Logger.class);
    Mockito.when(mockLogger.isErrorEnabled()).thenReturn(true);
    try {/*from   w w w. jav  a  2  s . com*/
        throw new RemoteException("*** EXCEPTION MESSAGE ONE!!! ***");
    } catch (RemoteException re1) {
        try {
            throw new RuntimeException("*** EXCEPTION MESSAGE TWO!!! ***", re1);
        } catch (RuntimeException re2) {
            try {
                throw new AccessException("*** EXCEPTION MESSAGE THREE!!! ***", re2);
            } catch (AccessException ae) {
                String message = "This is a test of the LogUtil utility";

                // Now test what would be logged.

                // First, without exception local message logging.
                LogUtil.setIncludeExceptionMessage(false);
                LogUtil.error(mockLogger, message, ae);
                Mockito.verify(mockLogger).error(Mockito.eq(message),
                        Mockito.argThat(new IsCorrectException()));

                // Next, with exception local message logging.
                LogUtil.setIncludeExceptionMessage(true);
                LogUtil.error(mockLogger, message, ae);
                Mockito.verify(mockLogger).error(Mockito.eq(message),
                        Mockito.argThat(new IsCorrectException()));
            }
        }
    }

}