Skip to content

Commit

Permalink
Merge pull request #3 from nbaztec/add-functional-test
Browse files Browse the repository at this point in the history
add functional test
  • Loading branch information
Nisheeth Barthwal authored Aug 3, 2020
2 parents 01d196e + 42f3097 commit 129684d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "com.github.nbaztec"
version = "1.0.4"
version = "1.0.5"

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString()
Expand Down Expand Up @@ -57,7 +57,7 @@ plugins {
`maven-publish`
id("org.jetbrains.kotlin.jvm") version "1.3.72"
id("com.gradle.plugin-publish") version "0.12.0"
id("com.github.nbaztec.coveralls-jacoco-kotlin") version "1.0.3"
id("com.github.nbaztec.coveralls-jacoco") version "1.0.4"
}

coverallsJacoco {
Expand Down
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 129684d

Please sign in to comment.