@Override
    public int getAttemptCount(int subtaskIndex) {
        Preconditions.checkArgument(subtaskIndex >= 0);
        if (subtaskIndex >= attemptCounts.size()) {
            return 0;
        }
        return attemptCounts.get(subtaskIndex);
    }
@Test
    void testNegativeSubtaskIndexRejected() {
        final DefaultSubtaskAttemptNumberStore subtaskAttemptNumberStore =
                new DefaultSubtaskAttemptNumberStore(Collections.emptyList());

        assertThatThrownBy(() -> subtaskAttemptNumberStore.getAttemptCount(-1))
                .isInstanceOf(IllegalArgumentException.class);
    }