<commit_before>package org.gradle.script.lang.kotlin.samples

import org.gradle.testkit.runner.TaskOutcome

import org.hamcrest.CoreMatchers.equalTo
import org.junit.Assert.assertThat

import org.junit.Test


class CodeQualitySampleTest : AbstractSampleTest("code-quality") {

    @Test
    fun `code quality plugins are properly configured`() {

        val result = build("build")

        assertThat(result.task(":checkstyleMain").outcome, equalTo(TaskOutcome.SUCCESS))
        assertThat(result.task(":checkstyleTest").outcome, equalTo(TaskOutcome.SUCCESS))

        assertThat(result.task(":findbugsMain").outcome, equalTo(TaskOutcome.SUCCESS))
        assertThat(result.task(":findbugsTest").outcome, equalTo(TaskOutcome.SUCCESS))

        assertThat(result.task(":pmdMain").outcome, equalTo(TaskOutcome.SUCCESS))
        assertThat(result.task(":pmdTest").outcome, equalTo(TaskOutcome.SUCCESS))

        assertThat(result.task(":jdependMain").outcome, equalTo(TaskOutcome.SUCCESS))
        assertThat(result.task(":jdependTest").outcome, equalTo(TaskOutcome.SUCCESS))

        assertThat(result.task(":jacocoTestCoverageVerification").outcome, equalTo(TaskOutcome.SUCCESS))
    }
}<commit_msg>Dedupe assertions with a list of task names<commit_after>package org.gradle.script.lang.kotlin.samples

import org.gradle.testkit.runner.TaskOutcome

import org.hamcrest.CoreMatchers.equalTo
import org.junit.Assert.assertThat

import org.junit.Test


class CodeQualitySampleTest : AbstractSampleTest("code-quality") {

    @Test
    fun `code quality plugins are properly configured`() {

        val result = build("build")

        val successfulTasks = listOf(
            ":checkstyleMain",
            ":checkstyleTest",
            ":findbugsMain",
            ":findbugsTest",
            ":pmdMain",
            ":pmdTest",
            ":jdependMain",
            ":jdependTest",
            ":jacocoTestCoverageVerification")

        successfulTasks.forEach { taskName ->
            assertThat(result.task(taskName).outcome, equalTo(TaskOutcome.SUCCESS))
        }
    }
}
{'fraction_non_alphanumeric': 0.1200192030724916, 'fraction_numerical': 0.0, 'mean_word_length': 3.6414253897550113, 'pattern_counts': {'":': 18, '<': 3, '<?xml version=': 0, '>': 4, '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': '424296', 'n_tokens_mistral': 615, 'n_tokens_neox': 594, 'n_words': 89}