avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-sandbox/merlin/assembly/src/test/org/apache/avalon/assembly/engine/type TypeRepositoryTestCase.java
Date Tue, 08 Jul 2003 17:41:24 GMT
bloritsch    2003/07/08 10:41:24

  Modified:    merlin/assembly/src/test/org/apache/avalon/assembly/engine/type
                        TypeRepositoryTestCase.java
  Log:
  Test for the correct exceptions.  Failures are for tests where we tested for something but
it did not pass.  Errors are for exceptions that are thrown that were not tested for.
  
  Revision  Changes    Path
  1.4       +35 -38    avalon-sandbox/merlin/assembly/src/test/org/apache/avalon/assembly/engine/type/TypeRepositoryTestCase.java
  
  Index: TypeRepositoryTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/test/org/apache/avalon/assembly/engine/type/TypeRepositoryTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TypeRepositoryTestCase.java	29 Apr 2003 14:39:44 -0000	1.3
  +++ TypeRepositoryTestCase.java	8 Jul 2003 17:41:24 -0000	1.4
  @@ -67,11 +67,6 @@
       private TypeRepository m_manager;
       protected ClassLoader m_loader = Thread.currentThread().getContextClassLoader();
   
  -    public TypeRepositoryTestCase()
  -    {
  -        this( "TypeRepositoryTestCase" );
  -    }
  -
       public TypeRepositoryTestCase( String name )
       {
           super( name );
  @@ -91,13 +86,14 @@
   
           try
           {
  -            assertTrue( m_manager.createType( classname ) != null );
  -        } catch( Throwable e )
  +            assertNotNull( m_manager.createType( classname ) );
  +        }
  +        catch( TypeException e )
           {
               String error = ExceptionHelper.packException( "testBasic - type creation failure",
e );
               getLogger().error( error );
  -            assertTrue( false );
               e.printStackTrace();
  +            fail();
           }
       }
   
  @@ -107,13 +103,14 @@
   
           try
           {
  -            assertTrue( m_manager.createType( classname ) != null );
  -        } catch( Throwable e )
  +            assertNotNull( m_manager.createType( classname ) );
  +        }
  +        catch( TypeException e )
           {
               String error = ExceptionHelper.packException( "testSimple - type creation failure",
e );
               getLogger().error( error );
  -            assertTrue( false );
               e.printStackTrace();
  +            fail();
           }
       }
   
  @@ -123,13 +120,14 @@
   
           try
           {
  -            assertTrue( m_manager.createType( classname ) != null );
  -        } catch( Throwable e )
  +            assertNotNull( m_manager.createType( classname ) );
  +        }
  +        catch( TypeException e )
           {
               String error = ExceptionHelper.packException( "testComplex - type creation
failure", e );
               getLogger().error( error );
  -            assertTrue( false );
               e.printStackTrace();
  +            fail();
           }
       }
   
  @@ -138,16 +136,18 @@
           try
           {
               m_manager.createType( (String) null );
  -            assertTrue( false );
  -        } catch( NullPointerException e )
  +            fail("Did not throw expected NullPointerException");
  +        }
  +        catch( NullPointerException e )
           {
  -            assertTrue( true );
  -        } catch( Throwable e )
  +            // Success!!
  +        }
  +        catch( TypeException e )
           {
               String error = ExceptionHelper.packException( "testNull", e );
               getLogger().error( error );
  -            assertTrue( false );
               e.printStackTrace();
  +            fail();
           }
       }
   
  @@ -156,17 +156,12 @@
           final String classname = "org.something.else";
           try
           {
  -            Type type = m_manager.createType( classname );
  -            assertTrue( false );
  -        } catch( TypeException e )
  -        {
  -            assertTrue( true );
  -        } catch( Throwable e )
  +            m_manager.createType( classname );
  +            fail("Did not throw expected TypeException");
  +        }
  +        catch( TypeException e )
           {
  -            String error = ExceptionHelper.packException(
  -                    "anti-failure for creation of invalid type", e );
  -            getLogger().error( error );
  -            assertTrue( false );
  +            // Success!!
           }
       }
   
  @@ -186,13 +181,14 @@
               m_manager.addType( basicType );
               m_manager.addType( simpleType );
   
  -            assertTrue( true );
  -        } catch( Throwable e )
  +            // Success !!
  +        }
  +        catch( TypeException e )
           {
               String error = ExceptionHelper.packException(
                       "type addition failure", e );
               getLogger().error( error );
  -            assertTrue( false );
  +            fail();
           }
   
           //
  @@ -201,16 +197,17 @@
   
           try
           {
  -            complexType.equals( m_manager.getType( complex ) );
  -            basicType.equals( m_manager.getType( basic ) );
  -            simpleType.equals( m_manager.getType( simple ) );
  -            assertTrue( true );
  -        } catch( Throwable e )
  +            assertEquals(complexType, m_manager.getType( complex ) );
  +            assertEquals(basicType, m_manager.getType( basic ) );
  +            assertEquals(simpleType, m_manager.getType( simple ) );
  +            // Success!!
  +        }
  +        catch( TypeException e )
           {
               String error = ExceptionHelper.packException(
                       "type retrival failure", e );
               getLogger().error( error );
  -            assertTrue( false );
  +            fail();
           }
   
           //
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message