001 package nl.cwi.sen1.visbase.rstorecontainer;
002
003 import junit.framework.TestCase;
004
005 /**
006 * Used to test the RStoreParseExceptionTest code
007 *
008 * @author Ricardo Lindooren
009 * @author Arend van Beelen (reviewer)
010 * @date 2007-02-20
011 */
012 public class RStoreParseExceptionTest extends TestCase {
013
014 private final static String MESSAGE = "fakeMessage";
015 private final static String MESSAGE2 = "fakeMessage2";
016
017 public void testRStoreParseException() {
018 RStoreParseException rpe = new RStoreParseException();
019 assertNotNull(rpe);
020 }
021
022 public void testRStoreParseExceptionString() {
023 RStoreParseException rpe = new RStoreParseException(MESSAGE);
024 assertEquals(MESSAGE, rpe.getMessage());
025 }
026
027 public void testRStoreParseExceptionStringThrowable() {
028 RStoreParseException rpe = null;
029 Exception exp;
030
031 try {
032 throw new Exception(MESSAGE);
033 } catch (Exception ex) {
034 exp = ex;
035 rpe = new RStoreParseException(MESSAGE2, ex);
036 }
037
038 assertNotNull(rpe);
039 assertEquals(MESSAGE2, rpe.getMessage());
040 assertEquals(exp, rpe.getCause());
041 assertEquals(MESSAGE, rpe.getCause().getMessage());
042 }
043
044 public void testRStoreParseExceptionThrowable() {
045 RStoreParseException rpe = null;
046 Exception exp;
047
048 try {
049 throw new Exception(MESSAGE);
050 } catch (Exception ex) {
051 exp = ex;
052 rpe = new RStoreParseException(ex);
053 }
054
055 assertNotNull(rpe);
056 assertEquals(exp, rpe.getCause());
057 assertEquals(MESSAGE, rpe.getCause().getMessage());
058 }
059 }