org.apache.commons.lang.exception.NestableException Java Examples

The following examples show how to use org.apache.commons.lang.exception.NestableException. 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: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testGetThrowable() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    
    assertEquals(3, ex.getThrowableCount());
    
    assertEquals(NotImplementedException.class, ex.getThrowable(0).getClass());
    assertEquals("Code is not implemented", ex.getThrowable(0).getMessage());
    assertEquals(NestableException.class, ex.getThrowable(1).getClass());
    assertEquals("nested 1", ex.getThrowable(1).getMessage());
    assertEquals(NestableException.class, ex.getThrowable(2).getClass());
    assertEquals("nested 2", ex.getThrowable(2).getMessage());
    
    assertEquals(3, ex.getThrowables().length);
    assertEquals(NotImplementedException.class, ex.getThrowables()[0].getClass());
    assertEquals("Code is not implemented", ex.getThrowables()[0].getMessage());
    assertEquals(NestableException.class, ex.getThrowables()[1].getClass());
    assertEquals("nested 1", ex.getThrowables()[1].getMessage());
    assertEquals(NestableException.class, ex.getThrowables()[2].getClass());
    assertEquals("nested 2", ex.getThrowables()[2].getMessage());
}
 
Example #2
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testGetThrowable() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    
    assertEquals(3, ex.getThrowableCount());
    
    assertEquals(NotImplementedException.class, ex.getThrowable(0).getClass());
    assertEquals("Code is not implemented", ex.getThrowable(0).getMessage());
    assertEquals(NestableException.class, ex.getThrowable(1).getClass());
    assertEquals("nested 1", ex.getThrowable(1).getMessage());
    assertEquals(NestableException.class, ex.getThrowable(2).getClass());
    assertEquals("nested 2", ex.getThrowable(2).getMessage());
    
    assertEquals(3, ex.getThrowables().length);
    assertEquals(NotImplementedException.class, ex.getThrowables()[0].getClass());
    assertEquals("Code is not implemented", ex.getThrowables()[0].getMessage());
    assertEquals(NestableException.class, ex.getThrowables()[1].getClass());
    assertEquals("nested 1", ex.getThrowables()[1].getMessage());
    assertEquals(NestableException.class, ex.getThrowables()[2].getClass());
    assertEquals("nested 2", ex.getThrowables()[2].getMessage());
}
 
Example #3
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPrintStackTrace() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    PrintStream errStream = System.err;
    System.setErr(ps);
    ex.printStackTrace();
    System.setErr(errStream);
    assertTrue(baos.toString().length() > 0);
}
 
Example #4
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPrintPartialStackTrace_Writer() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    ex.printPartialStackTrace(writer);
    assertTrue(stringWriter.toString().length() > 0);
}
 
Example #5
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPrintStackTrace_Writer() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    ex.printStackTrace(writer);
    assertTrue(stringWriter.toString().length() > 0);
}
 
Example #6
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPrintStackTrace_Stream() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    ex.printStackTrace(ps);
    assertTrue(baos.toString().length() > 0);
}
 
Example #7
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPrintStackTrace() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    PrintStream errStream = System.err;
    System.setErr(ps);
    ex.printStackTrace();
    System.setErr(errStream);
    assertTrue(baos.toString().length() > 0);
}
 
Example #8
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPrintPartialStackTrace_Writer() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    ex.printPartialStackTrace(writer);
    assertTrue(stringWriter.toString().length() > 0);
}
 
Example #9
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPrintStackTrace_Writer() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    ex.printStackTrace(writer);
    assertTrue(stringWriter.toString().length() > 0);
}
 
Example #10
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testPrintStackTrace_Stream() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    ex.printStackTrace(ps);
    assertTrue(baos.toString().length() > 0);
}
 
Example #11
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void testIndexOfThrowable() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    assertEquals(0, ex.indexOfThrowable(NotImplementedException.class));
    assertEquals(1, ex.indexOfThrowable(NestableException.class));
}
 
Example #12
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void testIndexOfThrowable_Index() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    assertEquals(1, ex.indexOfThrowable(NestableException.class, 1));
}
 
Example #13
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void testIndexOfThrowable_Index() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    assertEquals(1, ex.indexOfThrowable(NestableException.class, 1));
}
 
Example #14
Source File: NotImplementedExceptionTest.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void testIndexOfThrowable() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    assertEquals(0, ex.indexOfThrowable(NotImplementedException.class));
    assertEquals(1, ex.indexOfThrowable(NestableException.class));
}
 
Example #15
Source File: NestableException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message.
 *
 * @param msg The error message.
 */
public NestableException(String msg) {
    super(msg);
}
 
Example #16
Source File: NestableException.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message.
 *
 * @param msg The error message.
 */
public NestableException(String msg) {
    super(msg);
}
 
Example #17
Source File: NestableException.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * nested <code>Throwable</code>.
 *
 * @param cause the exception or error that caused this exception to be
 * thrown
 */
public NestableException(Throwable cause) {
    super();
    this.cause = cause;
}
 
Example #18
Source File: NestableException.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message and nested <code>Throwable</code>.
 *
 * @param msg    the error message
 * @param cause  the exception or error that caused this exception to be
 * thrown
 */
public NestableException(String msg, Throwable cause) {
    super(msg);
    this.cause = cause;
}
 
Example #19
Source File: NestableException.java    From cacheonix-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> without specified
 * detail message.
 */
public NestableException() {
	super();
}
 
Example #20
Source File: NestableException.java    From cacheonix-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message.
 *
 * @param msg The error message.
 */
public NestableException(String msg) {
	super( msg );
}
 
Example #21
Source File: NestableException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message and nested <code>Throwable</code>.
 *
 * @param msg    the error message
 * @param cause  the exception or error that caused this exception to be
 * thrown
 */
public NestableException(String msg, Throwable cause) {
    super(msg);
    this.cause = cause;
}
 
Example #22
Source File: NestableException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * nested <code>Throwable</code>.
 *
 * @param cause the exception or error that caused this exception to be
 * thrown
 */
public NestableException(Throwable cause) {
    super();
    this.cause = cause;
}
 
Example #23
Source File: NestableException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * nested <code>Throwable</code>.
 *
 * @param cause the exception or error that caused this exception to be
 * thrown
 */
public NestableException(Throwable cause) {
    super();
    this.cause = cause;
}
 
Example #24
Source File: NestableException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> without specified
 * detail message.
 */
public NestableException() {
    super();
}
 
Example #25
Source File: NestableException.java    From cacheonix-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * nested <code>Throwable</code>.
 *
 * @param cause the exception or error that caused this exception to be
 *              thrown
 */
public NestableException(Throwable cause) {
	super();
	this.cause = cause;
}
 
Example #26
Source File: NestableException.java    From cacheonix-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message and nested <code>Throwable</code>.
 *
 * @param msg   the error message
 * @param cause the exception or error that caused this exception to be
 *              thrown
 */
public NestableException(String msg, Throwable cause) {
	super( msg );
	this.cause = cause;
}
 
Example #27
Source File: NestableException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> without specified
 * detail message.
 */
public NestableException() {
    super();
}
 
Example #28
Source File: NestableException.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> without specified
 * detail message.
 */
public NestableException() {
    super();
}
 
Example #29
Source File: NestableException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message.
 *
 * @param msg The error message.
 */
public NestableException(String msg) {
    super(msg);
}
 
Example #30
Source File: NestableException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message and nested <code>Throwable</code>.
 *
 * @param msg    the error message
 * @param cause  the exception or error that caused this exception to be
 * thrown
 */
public NestableException(String msg, Throwable cause) {
    super(msg);
    this.cause = cause;
}