<commit_before>package org.mockito.release.notes.vcs

import spock.lang.Specification

class IgnoredCommitTest extends Specification {

    def "should skip commits that contains given ignored substrings"() {
        def ignoredCommit = new IgnoredCommit(["[ci skip]", "[custom skip]"])
        def commitWithCiSkip = new GitCommit("firstCommitId", "<EMAIL>", "sampleAuthor", "sample [ci skip] commit message")
        def commitWithCustomSkip = new GitCommit("thirdCommitId", "<EMAIL>", "sampleAuthor", "sample [custom skip] commit message")
        def commitWithoutSkipSubstringInMessage = new GitCommit("firstCommitId", "<EMAIL>", "sampleAuthor", "sample commit message")

        expect:
        ignoredCommit.isTrue(commitWithCiSkip)
        ignoredCommit.isTrue(commitWithCustomSkip)
        ignoredCommit.isTrue(commitWithoutSkipSubstringInMessage) == false
    }

    def "should not skip commit if ignored substrings list is empty"() {
        def ignoredCommit = new IgnoredCommit([])
        def commitWithCiSkip = new GitCommit("firstCommitId", "<EMAIL>", "sampleAuthor", "sample [ci skip] commit message")

        expect:
        ignoredCommit.isTrue(commitWithCiSkip) == false
    }
}<commit_msg>GitCommit creation extracted to private method<commit_after>package org.mockito.release.notes.vcs

import spock.lang.Specification

class IgnoredCommitTest extends Specification {

    def "should skip commits that contains given ignored substrings"() {
        def ignoredCommit = new IgnoredCommit(["[ci skip]", "[custom skip]"])
        def commitWithCiSkip = createGitCommitWithMessage("sample [ci skip] commit message")
        def commitWithCustomSkip = createGitCommitWithMessage("sample [custom skip] commit message")
        def commitWithoutSkipSubstringInMessage = createGitCommitWithMessage("sample commit message")

        expect:
        ignoredCommit.isTrue(commitWithCiSkip)
        ignoredCommit.isTrue(commitWithCustomSkip)
        ignoredCommit.isTrue(commitWithoutSkipSubstringInMessage) == false
    }

    def "should not skip commit if ignored substrings list is empty"() {
        def ignoredCommit = new IgnoredCommit([])
        def commitWithCiSkip = new GitCommit("firstCommitId", "<EMAIL>", "sampleAuthor", "sample [ci skip] commit message")

        expect:
        ignoredCommit.isTrue(commitWithCiSkip) == false
    }

    private GitCommit createGitCommitWithMessage(message) {
        new GitCommit("id", "<EMAIL>", "sampleAuthor", message)
    }
}
{'fraction_non_alphanumeric': 0.09779559118236474, 'fraction_numerical': 0.0, 'mean_word_length': 4.1891891891891895, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5108363', 'n_tokens_mistral': 661, 'n_tokens_neox': 676, 'n_words': 179}