DriverDetailsDialogController extends AbstractController { @SuppressWarnings( "unused" ) public void saveDriver() { try { File driverBundle = getDriverBundle(); File saveLocation = getDriverSaveLocation(); if ( saveLocation == null ) { return; } FileUtils.copyFile( driverBundle, saveLocation ); } catch ( IOException ioe ) { showErrorDialog( ioe ); ioe.printStackTrace(); } } DriverDetailsDialogController(); @SuppressWarnings( "unused" ) // Bound via XUL void saveDriver(); @SuppressWarnings( "unused" ) // Bound via XUL void showHelp(); @SuppressWarnings( "unused" ) // Bound via XUL void close();  }
@Test public void testSaveDriver() throws Exception { doCallRealMethod().when( controller ).saveDriver(); doReturn( null ).when( controller ).getDriverSaveLocation(); controller.saveDriver(); verify( controller ).getDriverBundle(); verify( controller ).getDriverSaveLocation(); }