public void appendSnapshot(
        final long recordingId,
        final long leadershipTermId,
        final long termBaseLogPosition,
        final long logPosition,
        final long timestamp,
        final int serviceId)
    {
        validateRecordingId(recordingId);

        if (!restoreInvalidSnapshot(
            recordingId, leadershipTermId, termBaseLogPosition, logPosition, timestamp, serviceId))
        {
            append(
                ENTRY_TYPE_SNAPSHOT,
                recordingId,
                leadershipTermId,
                termBaseLogPosition,
                logPosition,
                timestamp,
                serviceId,
                null);
        }
    }
@Test
    void shouldNotAllowInvalidateOfSnapshotWithoutParentTerm()
    {
        try (RecordingLog recordingLog = new RecordingLog(tempDir, true))
        {
            recordingLog.appendSnapshot(-10, 1L, 0, 777L, 0, 0);
            recordingLog.appendSnapshot(-11, 1L, 0, 777L, 0, SERVICE_ID);

            final ClusterException ex = assertThrows(ClusterException.class, recordingLog::invalidateLatestSnapshot);
            assertEquals("ERROR - no matching term for snapshot: leadershipTermId=1", ex.getMessage());
        }
    }