<commit_before>package org.shipkit.internal.gradle

import org.shipkit.gradle.ReleaseConfiguration
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll
import testutil.ReflectionUtil

import java.lang.reflect.Method

class ReleaseConfigurationGettersAndSettersTest extends Specification {

    @Shared
    def conf = new ReleaseConfiguration()
    @Shared
    int counter = 0

    def "default values"() {
        conf.team.developers.empty
        conf.team.contributors.empty
        conf.git.commitMessagePostfix == "[ci skip]"
        conf.releaseNotes.ignoreCommitsContaining == ["[ci skip]"]
    }

    @Unroll
    def "setter #setter.name value should be the same like #getter.name"(row, Method setter, Method getter, Object obj) {
        def valueForSetter = getValueForSetter(setter)
        setter.invoke(obj, valueForSetter)

        expect:
        getter.invoke(obj) == valueForSetter

        where:
        row << ReflectionUtil.findGettersAndSetters(conf)
        setter = row.setter
        getter = row.getter
        obj = row.object
    }

    def getValueForSetter(Method setter) {
        counter++;
        if (setter.parameters[0].type == String.class) {
            return 'some string' + counter
        }

        if (setter.parameters[0].type.name == "boolean") {
            return (counter % 2 == 0);
        }

        if (setter.parameters[0].type == Map.class) {<commit_msg>changing the name of test<commit_after>package org.shipkit.internal.gradle

import org.shipkit.gradle.ReleaseConfiguration
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll
import testutil.ReflectionUtil

import java.lang.reflect.Method

class ReleaseConfigurationGettersAndSettersTest extends Specification {

    @Shared
    def conf = new ReleaseConfiguration()
    @Shared
    int counter = 0

    def "default values"() {
        conf.team.developers.empty
        conf.team.contributors.empty
        conf.git.commitMessagePostfix == "[ci skip]"
        conf.releaseNotes.ignoreCommitsContaining == ["[ci skip]"]
    }

    @Unroll
    def "value assigned to #setter.name should be returned by #getter.name"(row, Method setter, Method getter, Object obj) {
        def valueForSetter = getValueForSetter(setter)
        setter.invoke(obj, valueForSetter)

        expect:
        getter.invoke(obj) == valueForSetter

        where:
        row << ReflectionUtil.findGettersAndSetters(conf)
        setter = row.setter
        getter = row.getter
        obj = row.object
    }

    def getValueForSetter(Method setter) {
        counter++;
        if (setter.parameters[0].type == String.class) {
            return 'some string' + counter
        }

        if (setter.parameters[0].type.name == "boolean") {
            return (counter % 2 == 0);
        }

        if (setter.parameters[0].type == Map.class) {
{'fraction_non_alphanumeric': 0.09968847352024922, 'fraction_numerical': 0.004153686396677051, 'mean_word_length': 2.690932311621967, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '4945158', 'n_tokens_mistral': 866, 'n_tokens_neox': 821, 'n_words': 190}