public void testNullPointerException() throws Exception
{
try
{
new MetaInfoEntry( null );
fail( "Did not throw an exception" );
}
catch ( NullPointerException npe )
{
// SUCCESS!
}
catch ( Exception e )
{
fail( "Threw wrong exception type: " + e.getClass().getName() );
}
try
{
new MetaInfoEntry( null, m_properties, m_dependencies );
fail( "Did not throw an exception" );
}
catch ( NullPointerException npe )
{
// SUCCESS!
}
catch ( Exception e )
{
fail( "Threw wrong exception type: " + e.getClass().getName() );
}
try
{
new MetaInfoEntry( m_componentClass, null, m_dependencies );
fail( "Did not throw an exception" );
}
catch ( NullPointerException npe )
{
// SUCCESS!
}
catch ( Exception e )
{
fail( "Threw wrong exception type: " + e.getClass().getName() );
}
try
{
new MetaInfoEntry( m_componentClass, m_properties, null );
fail( "Did not throw an exception" );
}
catch ( NullPointerException npe )
{
// SUCCESS!
}
catch ( Exception e )
{
fail( "Threw wrong exception type: " + e.getClass().getName() );
}
try
{
MetaInfoEntry entry = new MetaInfoEntry( m_componentClass, m_properties, m_dependencies );
entry.addRole( null );
fail( "Did not throw an exception" );
}
catch ( NullPointerException npe )
{
// SUCCESS!
}
catch ( Exception e )
{
fail( "Threw wrong exception type: " + e.getClass().getName() );
}
try
{
MetaInfoEntry entry = new MetaInfoEntry( m_componentClass, m_properties, m_dependencies );
entry.addRole( Role1.class.getName() );
entry.containsRole( null );
fail( "Did not throw an exception" );
}
catch ( NullPointerException npe )
{
// SUCCESS!