Skip to content

Commit

Permalink
test: tiny test for gradle-testkit-truth.
Browse files Browse the repository at this point in the history
Should be somewhere else but I'm feeling lazy.
  • Loading branch information
autonomousapps committed Jan 16, 2024
1 parent 7c1f58b commit 328a104
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import com.autonomousapps.jvm.projects.ApplicationProject
import com.autonomousapps.kit.SourceType
import com.autonomousapps.kit.gradle.Plugin
import com.autonomousapps.kit.gradle.dependencies.Plugins
import com.autonomousapps.kit.truth.artifact.BuildArtifactsSubject

import static com.autonomousapps.kit.truth.artifact.BuildArtifactsSubject.buildArtifacts
import static com.autonomousapps.utils.Runner.build
import static com.google.common.truth.Truth.assertAbout
import static com.google.common.truth.Truth.assertThat

final class ApplicationSpec extends AbstractJvmSpec {
Expand Down Expand Up @@ -35,10 +38,17 @@ final class ApplicationSpec extends AbstractJvmSpec {
gradleProject = project.gradleProject
when:
build(gradleVersion, gradleProject.rootDir, 'buildHealth')
build(gradleVersion, gradleProject.rootDir, 'buildHealth', 'proj:jar')
then:
assertThat(project.actualBuildHealth()).containsExactlyElementsIn(project.expectedBuildHealth)
// TODO(tsr): put this assertion somewhere else. It's only for TestKit-Truth
assertAbout(buildArtifacts())
.that(project.gradleProject.singleArtifact('proj', 'libs/proj.jar'))
.jar()
.resource('res.txt')
.text()
.isEqualTo('foo=bar')
where:
gradleVersion << gradleVersions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,18 @@ final class ApplicationProject extends AbstractProject {
s.withBuildScript { bs ->
bs.plugins = plugins
bs.dependencies = dependencies()

// TODO(tsr): put this somewhere else. It's only for TestKit-Truth
bs.withGroovy(
"""\
processResources {
from 'res.txt'
}
"""
)
}
// TODO(tsr): put this somewhere else. It's only for TestKit-Truth
s.withFile('res.txt', 'foo=bar')
}

def project = builder.build()
Expand Down

0 comments on commit 328a104

Please sign in to comment.