commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: jakarta-commons-sandbox/lang/src/test/org/apache/commons/lang/exception NestableDelegateTestCase.java
Date Sat, 09 Mar 2002 17:28:20 GMT
dlr         02/03/09 09:28:20

  Modified:    lang/src/test/org/apache/commons/lang/exception
                        NestableDelegateTestCase.java
  Log:
  Cleaned up test case a bit -- still does not pass.
  
  Revision  Changes    Path
  1.2       +12 -7     jakarta-commons-sandbox/lang/src/test/org/apache/commons/lang/exception/NestableDelegateTestCase.java
  
  Index: NestableDelegateTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/lang/src/test/org/apache/commons/lang/exception/NestableDelegateTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- NestableDelegateTestCase.java	8 Mar 2002 00:09:33 -0000	1.1
  +++ NestableDelegateTestCase.java	9 Mar 2002 17:28:20 -0000	1.2
  @@ -70,6 +70,9 @@
       private static final String CONSTRUCTOR_FAILED_MSG = 
       "The Nestable implementation passed to the NestableDelegate(Nestable) constructor must
extend java.lang.Throwable";
   
  +    private static final String PARTIAL_STACK_TRACE =
  +        "rethrown as ThrowableNestedNestable partial stack trace place-holder";
  +
       /**
        * Construct a new instance of NestableDelegateTestCase with the specified name
        */
  @@ -155,10 +158,12 @@
           String stack1 = baos1.toString();
           assertTrue("stack trace startsWith == java.lang.Exception: nested exception 3",
               stack1.startsWith("java.lang.Exception: nested exception 3"));
  -        int start1 = (stack1.length() - 2) - ("rethrown as ThrowableNestedNestable partial
stack trace place-holder").length();
  +        int start1 = (stack1.length() - 2) - PARTIAL_STACK_TRACE.length();
           int end1 = stack1.length() - 2;
  -        assertTrue("stack trace substring(" + start1 + "," + end1 + ") == rethrown as ThrowableNestedNestable
partial stack trace place-holder",
  -            stack1.substring(start1, end1).equals("rethrown as ThrowableNestedNestable
partial stack trace place-holder"));
  +        assertEquals("stack trace substring(" + start1 + "," + end1 + ") == " +
  +                     PARTIAL_STACK_TRACE,
  +                     PARTIAL_STACK_TRACE,
  +                     stack1.substring(start1, end1));
   
           ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
           PrintStream ps2 = new PrintStream(baos2);
  @@ -167,10 +172,10 @@
           String stack2 = baos2.toString();
           assertTrue("stack trace startsWith == java.lang.Exception: nested exception 3",
               stack2.startsWith("java.lang.Exception: nested exception 3"));
  -        int start2 = (stack2.length() - 2) - ("rethrown as ThrowableNestedNestable partial
stack trace place-holder").length();
  +        int start2 = (stack2.length() - 2) - PARTIAL_STACK_TRACE.length();
           int end2 = stack2.length() - 2;
  -        assertTrue("stack trace substring(" + start2 + "," + end2 + ") == rethrown as ThrowableNestedNestable
partial stack trace place-holder",
  -            stack2.substring(start2, end2).equals("rethrown as ThrowableNestedNestable
partial stack trace place-holder"));
  +        assertTrue("stack trace substring(" + start2 + "," + end2 + ") == " + PARTIAL_STACK_TRACE,
  +            stack2.substring(start2, end2).equals(PARTIAL_STACK_TRACE));
       }
       
       public static void main(String args[])
  @@ -333,4 +338,4 @@
       {
       }
       
  -}
  \ No newline at end of file
  +}
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message