    @Test
    public void testNoPortAvailable() throws Exception {

        AvailablePortProvider portGenerator = new AvailablePortProvider(MIN_PORT_NUMBER, MIN_PORT_NUMBER + 3, p -> p > MAX_PORT_NUMBER);
        try {
            portGenerator.nextPort();
            fail("Should not reach this line");
        } catch (Exception e) {
            //its okay
        }
    }