### Question:
AvailablePortFinder { public static int getNextAvailable() { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket( 0 ); int port = serverSocket.getLocalPort(); serverSocket.close(); return port; } catch ( IOException ioe ) { throw new NoSuchElementException( ioe.getMessage() ); } } private  AvailablePortFinder(); static Set<Integer> getAvailablePorts(); static int getNextAvailable(); static int getNextAvailable( int fromPort ); static boolean available( int port ); static Set<Integer> getAvailablePorts( int fromPort, int toPort ); static final int MIN_PORT_NUMBER; static final int MAX_PORT_NUMBER; }### Answer:
@Test public void testGetNextAvailable_0args() { int result = AvailablePortFinder.getNextAvailable(); assertTrue( result > 0 ); }
@Test public void testGetNextAvailable_int() { int result = AvailablePortFinder.getNextAvailable( 2000 ); assertTrue( result >= 2000 ); }