Skip to content

Commit

Permalink
add funtional test
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec committed Aug 3, 2020
1 parent 01d196e commit db58dac
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/kotlin/CoverallsJacocoPluginTest.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package org.gradle.plugin.coveralls.jacoco

import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import org.gradle.api.Action
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.internal.tasks.DefaultSourceSetContainer
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.testfixtures.ProjectBuilder
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import java.io.File

internal class CoverallsJacocoPluginTest {
@Test
Expand All @@ -23,6 +28,20 @@ internal class CoverallsJacocoPluginTest {
}
}

@Test
fun `CoverallsJacocoPlugin runs on task execute`() {
val sourceSetContainer = mockk<SourceSetContainer>()
every { sourceSetContainer.getByName("main").allJava.srcDirs } returns emptySet()
val project = ProjectBuilder.builder().withProjectDir(File(".")).build()
project.extensions.add("sourceSets", sourceSetContainer)

val plugin = CoverallsJacocoPlugin()
plugin.apply(project)

val task = project.tasks.getByName("coverallsJacoco")
task.actions.forEach { it.execute(task) }
}

@Test
fun `CoverallsJacocoPluginExtension has meaningful defaults`() {
val extension = CoverallsJacocoPluginExtension()
Expand Down

0 comments on commit db58dac

Please sign in to comment.