@Override
    public void setAttemptCount(JobVertexID jobVertexId, int subtaskIndex, int attemptNumber) {
        Preconditions.checkArgument(subtaskIndex >= 0);
        Preconditions.checkArgument(attemptNumber >= 0);

        final List<Integer> attemptCounts =
                vertexSubtaskToAttemptCounts.computeIfAbsent(
                        jobVertexId, ignored -> new ArrayList<>(32));
        while (subtaskIndex >= attemptCounts.size()) {
            attemptCounts.add(0);
        }
        attemptCounts.set(subtaskIndex, attemptNumber);
    }
@Test
    void testSetAttemptCountRejectsNegativeSubtaskIndex() {
        final DefaultVertexAttemptNumberStore vertexAttemptNumberStore =
                new DefaultVertexAttemptNumberStore();

        assertThatThrownBy(() -> vertexAttemptNumberStore.setAttemptCount(new JobVertexID(), -1, 0))
                .isInstanceOf(IllegalArgumentException.class);
    }