static int getNext(final CronEntry entry, final int current, final Calendar working) throws MessageFormatException {
        int result = 0;

        if (entry.currentWhen == null) {
            entry.currentWhen = calculateValues(entry);
        }

        List<Integer> list = entry.currentWhen;
        int next = -1;
        for (Integer i : list) {
            if (i > current) {
                next = i;
                break;
            }
        }
        if (next != -1) {
            result = next - current;
        } else {
            int first = list.get(0);

            int fixedEnd = entry.end;

            //months have different max values
            if("DayOfMonth".equals(entry.name)) {
                fixedEnd = working.getActualMaximum(Calendar.DAY_OF_MONTH)+1;
            }

            result = fixedEnd + first - entry.start - current;

            // Account for difference of one vs zero based indices.
            if (entry.name.equals("DayOfWeek") || entry.name.equals("Month")) {
                result++;
            }
        }

        return result;
    }
@Test
    public void testGetNext() throws MessageFormatException {
        testGetNextSingle("0 0 1 * *", "2016-04-15T00:00:00", "2016-05-01T00:00:00");
        testGetNextSingle("0 0 1,15 * *", "2016-04-15T00:00:00", "2016-05-01T00:00:00");
        testGetNextSingle("0 0 1 * *", "2016-05-15T00:00:00", "2016-06-01T00:00:00");
        testGetNextSingle("0 0 1,15 * *", "2016-05-15T00:00:00", "2016-06-01T00:00:00");
        testGetNextSingle("0 0 1 * *", "2016-06-15T00:00:00", "2016-07-01T00:00:00");
        testGetNextSingle("0 0 1,15 * *", "2016-06-15T00:00:00", "2016-07-01T00:00:00");
    }