Clover coverage report -
Coverage timestamp: Sun Feb 29 2004 21:42:04 CET
file stats: LOC: 154   Methods: 6
NCLOC: 105   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AssertTestCase.java - 97.8% 100% 98.1%
coverage coverage
 1   
 /* ====================================================================
 2   
  The Jicarilla Software License
 3   
 
 4   
  Copyright (c) 2003 Leo Simons.
 5   
  All rights reserved.
 6   
 
 7   
  Permission is hereby granted, free of charge, to any person obtaining
 8   
  a copy of this software and associated documentation files (the
 9   
  "Software"), to deal in the Software without restriction, including
 10   
  without limitation the rights to use, copy, modify, merge, publish,
 11   
  distribute, sublicense, and/or sell copies of the Software, and to
 12   
  permit persons to whom the Software is furnished to do so, subject to
 13   
  the following conditions:
 14   
 
 15   
  The above copyright notice and this permission notice shall be
 16   
  included in all copies or substantial portions of the Software.
 17   
 
 18   
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 19   
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 20   
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 21   
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 22   
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 23   
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 24   
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 25   
 ==================================================================== */
 26   
 package org.jicarilla.framework.test;
 27   
 
 28   
 import org.jicarilla.framework.Assert;
 29   
 import junit.framework.TestCase;
 30   
 
 31   
 /**
 32   
  * <a href="http://www.junit.org/">JUnit</a> {@link junit.framework.TestCase
 33   
  * testcase} for Assert.
 34   
  * 
 35   
  * @author <a href="lsimons at jicarilla dot org">Leo Simons</a>
 36   
  * @version $Id: AssertTestCase.java,v 1.2 2004/01/04 16:10:21 lsimons Exp $
 37   
  */
 38   
 public class AssertTestCase extends TestCase
 39   
 {
 40  1
     public void testAssertNotNull()
 41   
     {
 42  1
         Assert.assertNotNull( new Object() );
 43   
 
 44  1
         AssertionError a = null;
 45  1
         try
 46   
         {
 47  1
             Assert.assertNotNull( null );
 48   
         }
 49   
         catch( AssertionError ae )
 50   
         {
 51  1
             a = ae;
 52   
         }
 53  1
         assertNotNull( a );
 54   
     }
 55   
 
 56  1
     public void testAssertNotNullWithMessage()
 57   
     {
 58  1
         String msg = "msg";
 59   
 
 60  1
         Assert.assertNotNull( msg, new Object() );
 61   
 
 62  1
         AssertionError a = null;
 63  1
         try
 64   
         {
 65  1
             Assert.assertNotNull( msg, null );
 66   
         }
 67   
         catch( AssertionError ae )
 68   
         {
 69  1
             a = ae;
 70   
         }
 71  1
         assertNotNull( a );
 72  1
         assertEquals( msg, a.getMessage() );
 73   
     }
 74   
 
 75  1
     public void testAssertTrue()
 76   
     {
 77  1
         AssertionError a = null;
 78  1
         try
 79   
         {
 80  1
             Assert.assertTrue( true );
 81   
         }
 82   
         catch( AssertionError ae )
 83   
         {
 84  0
             a = ae;
 85   
         }
 86  1
         assertNull( a );
 87   
 
 88  1
         a = null;
 89  1
         try
 90   
         {
 91  1
             Assert.assertTrue( false );
 92   
         }
 93   
         catch( AssertionError ae )
 94   
         {
 95  1
             a = ae;
 96   
         }
 97  1
         assertNotNull( a );
 98   
     }
 99   
 
 100  1
     public void testAssertTrueWithMessage()
 101   
     {
 102  1
         String msg = "msg";
 103   
 
 104  1
         Assert.assertTrue( msg, true );
 105   
 
 106  1
         AssertionError a = null;
 107  1
         try
 108   
         {
 109  1
             Assert.assertTrue( msg, false );
 110   
         }
 111   
         catch( AssertionError ae )
 112   
         {
 113  1
             a = ae;
 114   
         }
 115  1
         assertNotNull( a );
 116  1
         assertEquals( msg, a.getMessage() );
 117   
     }
 118   
 
 119  1
     public void testAssertFalse()
 120   
     {
 121  1
         Assert.assertFalse( false );
 122   
 
 123  1
         AssertionError a = null;
 124  1
         try
 125   
         {
 126  1
             Assert.assertFalse( true );
 127   
         }
 128   
         catch( AssertionError ae )
 129   
         {
 130  1
             a = ae;
 131   
         }
 132  1
         assertNotNull( a );
 133   
     }
 134   
 
 135  1
     public void testAssertFalseWithMessage()
 136   
     {
 137  1
         String msg = "msg";
 138   
 
 139  1
         Assert.assertFalse( msg, false );
 140   
 
 141  1
         AssertionError a = null;
 142  1
         try
 143   
         {
 144  1
             Assert.assertFalse( msg, true );
 145   
         }
 146   
         catch( AssertionError ae )
 147   
         {
 148  1
             a = ae;
 149   
         }
 150  1
         assertNotNull( a );
 151  1
         assertEquals( msg, a.getMessage() );
 152   
     }
 153   
 }
 154