LoadDriversListener implements IPentahoSystemListener { @SuppressWarnings( "StatementWithEmptyBody" ) @Override public boolean startup( IPentahoSession session ) { for ( Driver driver : ServiceLoader.load( Driver.class ) ) { assert true; } return true; }  @SuppressWarnings( "StatementWithEmptyBody" ) @Override boolean startup( IPentahoSession session ); @Override void shutdown();  }
@Test public void testLoadsDrivers() throws Exception { LoadDriversListener listener = new LoadDriversListener(); listener.startup( null ); Enumeration<Driver> drivers = DriverManager.getDrivers(); while ( drivers.hasMoreElements() ) { Driver driver = drivers.nextElement(); if ( "org.pentaho.commons.system.LoadDriversListenerTest$FakeDriver".equals( driver.getClass().getName() ) ) { return; } } Assert.assertFalse( true, "didn't find FakeDriver" ); }