[EMAIL PROTECTED] wrote:
> + public void testExceptions()
> + throws Exception
> + {
> + //test when the object passed in the index(..) method is not a
> RepositoryMetadat instance
> + RepositoryIndexingFactory factory = ( RepositoryIndexingFactory )
> lookup( RepositoryIndexingFactory.ROLE );
> + indexer = factory.createMetadataRepositoryIndex( indexPath,
> repository );
> + try
> + {
> + Artifact artifact = getArtifact("org.apache.maven",
> "maven-artifact", "2.0.1");
> + indexer.index( artifact );
> + fail( "Must throw exception when the passed object is not a
> RepositoryMetadata object." );
> + }
> + catch( Exception e )
> + {
> + }
Are you expecting "Exception" or some other type of Exception? You
should catch the one you actually expect.
I also like this tip from Vincent's Junit book:
catch ( SpecificException expected )
{
assertTrue( true );
}
- Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]