void setup ( final Map < String , Object > properties ) { final List < SetupAction > successfulActions = new ArrayList < SetupAction > ( ) ; for ( final SetupAction action : setupActions ) { try { action . setup ( properties ) ; successfulActions . add ( action ) ; } catch ( final Throwable e ) { for ( SetupAction s : successfulActions ) { try { s . teardown ( properties ) ; } catch ( final Throwable t ) { // we ignore these, and just propagate the exception that caused the setup to fail } } throw new RuntimeException ( e ) ; } } }
Sets up the contexts . If any of the setup actions fail then any setup contexts are torn down and then the exception is wrapped and thrown