Show
Ignore:
Timestamp:
06/26/08 13:23:28 (4 years ago)
Author:
amandel
Message:

New generic fail assertion

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/java/org/jcoderz/commons/util/Assert.java

    r1011 r1037  
    3232 */ 
    3333package org.jcoderz.commons.util; 
     34 
     35import java.rmi.UnexpectedException; 
    3436 
    3537import org.jcoderz.commons.ArgumentMalformedException; 
     
    124126      } 
    125127   } 
     128 
     129   /** 
     130    * Can be called if an assertion already failed. This can be used at 
     131    * code positions that should never be reached at all. It throws 
     132    * an AssertionFailedException with the given message. 
     133    * 
     134    * @param message The message to be used in the exception. 
     135    * @throws AssertionFailedException always. 
     136    */ 
     137   public static void fail (String message) 
     138         throws AssertionFailedException 
     139   { 
     140      throw new AssertionFailedException(message); 
     141   } 
     142 
     143   /** 
     144    * Can be called if an exception is unexpectedly caught. This can 
     145    * be used at catch blocks that should never be reached at all. 
     146    * It throws an AssertionFailedException with the given nested 
     147    * exception. 
     148    * 
     149    * @param ex the exception that was not expected 
     150    * @throws UnexpectedExceptionException always. 
     151    */ 
     152//   public static void fail (Throwable ex) 
     153//         throws UnexpectedException 
     154//   { 
     155//      throw new UnexpectedExceptionException(ex); 
     156//   } 
    126157}