InstancesMngrImpl implements IInstancesMngr { static void processExceptions( Logger logger, List<Exception> exceptions, String msg ) throws IOException { for( Exception e : exceptions ) Utils.logException( logger, e ); if( exceptions.size() > 0 ) { logger.info( msg ); throw new IOException( msg ); } } InstancesMngrImpl(
			IMessagingMngr messagingMngr,
			INotificationMngr notificationMngr,
			ITargetsMngr targetsMngr,
			IRandomMngr randomMngr,
			ITargetConfigurator targetConfigurator ); void setTargetHandlerResolver( ITargetHandlerResolver targetHandlerResolver ); void setRuleBasedHandler( IAutonomicMngr autonomicMngr ); void setDmDomain( String dmDomain ); @Override void addInstance( ManagedApplication ma, Instance parentInstance, Instance instance ); @Override void instanceWasUpdated( Instance instance, ManagedApplication ma ); @Override void removeInstance( ManagedApplication ma, Instance instance ); @Override void removeInstance( ManagedApplication ma, Instance instance, boolean immediate ); @Override void restoreInstanceStates( ManagedApplication ma, TargetHandler targetHandler ); @Override void resynchronizeAgents( ManagedApplication ma ); @Override void changeInstanceState( ManagedApplication ma, Instance instance, InstanceStatus newStatus ); @Override void deployAndStartAll( ManagedApplication ma, Instance instance ); @Override void stopAll( ManagedApplication ma, Instance instance ); @Override void undeployAll( ManagedApplication ma, Instance instance );  }
@Test public void testProcessExceptions_noException() throws Exception { Logger logger = Logger.getLogger( getClass().getName()); List<Exception> exceptions = new ArrayList<>( 0 ); InstancesMngrImpl.processExceptions( logger, exceptions, "whatever" ); }
@Test( expected = IOException.class ) public void testProcessExceptions_withException() throws Exception { Logger logger = Logger.getLogger( getClass().getName()); List<Exception> exceptions = new ArrayList<>( 1 ); exceptions.add( new Exception( "oops" )); InstancesMngrImpl.processExceptions( logger, exceptions, "whatever" ); }