public void testPortNotInUse() throws CoreException {
  final MockLaunchConfiguration config=new MockLaunchConfiguration();
  for (int i=3000; i < 3500; i++) {
    String port=Integer.toString(i);
    if (NetworkUtilities.isPortAvailable(port)) {
      config.setAttribute(WebAppLaunchAttributes.SERVER_PORT,port);
      config.setAttribute(WebAppLaunchAttributes.AUTO_PORT_SELECTION,Boolean.FALSE);
      WebAppLaunchDelegate delegate=new WebAppLaunchDelegate();
      assertTrue(delegate.promptUserToContinueIfPortNotAvailable(config));
      return;
    }
  }
  fail("Test failed because we couldn't find an open port to test with");
}

public void testPortNotInUse ( ) throws CoreException { final MockLaunchConfiguration config = new MockLaunchConfiguration ( ) ; for ( int i = 3000 ; i < 3500 ; i ++ ) { String port = Integer . toString ( i ) ; if ( NetworkUtilities . isPortAvailable ( port ) ) { config . setAttribute ( WebAppLaunchAttributes . SERVER_PORT , port ) ; config . setAttribute ( WebAppLaunchAttributes . AUTO_PORT_SELECTION , Boolean . FALSE ) ; WebAppLaunchDelegate delegate = new WebAppLaunchDelegate ( ) ; assertTrue ( delegate . promptUserToContinueIfPortNotAvailable ( config ) ) ; return ; } } fail ( "Test failed because we couldn't find an open port to test with" ) ; }
test when a port is not in use and promptusertocontinueifportnotavailable returns true ( continue with launch )
