@Override
  public DataSource getNamedDataSource( String datasourceName ) throws DataSourceNamingException {
    ClassLoader original = Thread.currentThread().getContextClassLoader();
    try {
      Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
      return DatabaseUtil.getDataSourceFromJndi( datasourceName, new InitialContext() );
    } catch ( NamingException ex ) {
      throw new DataSourceNamingException( ex );
    } finally {
      Thread.currentThread().setContextClassLoader( original );
    }

  }
@Test
  public void testCl() throws NamingException {
    DataSource dataSource = mock( DataSource.class );
    when( context.lookup( testName ) ).thenReturn( dataSource );
    DatabaseUtil util = new DatabaseUtil();
    ClassLoader orig = Thread.currentThread().getContextClassLoader();
    ClassLoader cl = mock( ClassLoader.class );
    try {
      Thread.currentThread().setContextClassLoader( cl );
      util.getNamedDataSource( testName );
    } catch ( Exception ex ) {
    } finally {
      try {
        verify( cl, never() ).loadClass( anyString() );
        verify( cl, never() ).getResource( anyString() );
        verify( cl, never() ).getResourceAsStream( anyString() );
      } catch ( Exception ex ) {
      }
      Thread.currentThread().setContextClassLoader( orig );
    }
  }