Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SingingBush committed May 21, 2022
1 parent 2c72c7d commit 18b9c18
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
# Don't increase beyond 7.2 until https://github.com/gradle/gradle/issues/20301 is fixed
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.saliman.gradle.plugin.cobertura

import org.gradle.api.Project
import org.gradle.api.internal.project.DefaultProject
import org.gradle.api.tasks.TaskCollection
import org.gradle.testfixtures.ProjectBuilder
import org.junit.Before
Expand Down Expand Up @@ -40,7 +41,7 @@ class CoberturaExtensionTest {
*/
@Test
void ignoreTrivial() {
extension.setCoverageIgnoreTrivial(true);
extension.setCoverageIgnoreTrivial(true)
assertTrue("Failed to set the ignoreTrivial flag", extension.getCoverageIgnoreTrivial())
}

Expand All @@ -51,7 +52,7 @@ class CoberturaExtensionTest {
*/
@Test
void ignoreMethodAnnotations() {
extension.setCoverageIgnoreMethodAnnotations(new ArrayList<String>());
extension.setCoverageIgnoreMethodAnnotations(new ArrayList<String>())
assertNotNull("Failed to set the coverageIgnoreMethodAnnotations", extension.getCoverageIgnoreTrivial())
}

Expand Down Expand Up @@ -228,7 +229,7 @@ class CoberturaExtensionTest {
*/
@Test
void setCoverageCheckRegexesNull() {
extension.coverageCheckRegexes = null;
extension.coverageCheckRegexes = null
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package net.saliman.gradle.plugin.cobertura

import org.gradle.tooling.GradleConnector
import org.gradle.tooling.ProjectConnection
import org.gradle.tooling.internal.consumer.DefaultBuildLauncher
import org.gradle.tooling.internal.consumer.DefaultGradleConnector
import org.junit.After
import org.junit.Before
import org.junit.Test
Expand All @@ -21,7 +24,10 @@ class CoberturaPluginExecutionTest {

@Before
void setUp() {
connection = GradleConnector.newConnector()
DefaultGradleConnector gradleConnector = (DefaultGradleConnector) GradleConnector.newConnector()
//gradleConnector.useDistributionBaseDir(GradleUserHomeLookup.gradleUserHome())

connection = gradleConnector
.forProjectDirectory(new File("testclient/calculator"))
.connect()
}
Expand All @@ -40,12 +46,15 @@ class CoberturaPluginExecutionTest {
void executeClean() {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
ByteArrayOutputStream errorStream = new ByteArrayOutputStream()
connection.newBuild()

DefaultBuildLauncher launcher = (DefaultBuildLauncher) connection.newBuild()
launcher
.withArguments("-b", "build.gradle")
.forTasks("clean")
.setStandardOutput(outputStream)
.setStandardError(errorStream)
.run()

outputStream.close()
errorStream.close()
String s = outputStream.toString()
Expand All @@ -64,7 +73,7 @@ class CoberturaPluginExecutionTest {
*/
@Test
void executeTestNoCobrtura() {
executeClean();
executeClean()
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
ByteArrayOutputStream errorStream = new ByteArrayOutputStream()
connection.newBuild()
Expand Down Expand Up @@ -98,7 +107,7 @@ class CoberturaPluginExecutionTest {
*/
@Test
void executeCobertura() {
executeClean();
executeClean()
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
ByteArrayOutputStream errorStream = new ByteArrayOutputStream()
connection.newBuild()
Expand Down Expand Up @@ -135,7 +144,7 @@ class CoberturaPluginExecutionTest {
*/
@Test
void executeCoberturaDryRun() {
executeClean();
executeClean()
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
ByteArrayOutputStream errorStream = new ByteArrayOutputStream()
connection.newBuild()
Expand Down Expand Up @@ -168,7 +177,7 @@ class CoberturaPluginExecutionTest {
*/
@Test
void executeTestCoberturaReport() {
executeClean();
executeClean()
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
ByteArrayOutputStream errorStream = new ByteArrayOutputStream()
connection.newBuild()
Expand Down Expand Up @@ -202,7 +211,7 @@ class CoberturaPluginExecutionTest {
*/
@Test
void executeTestCoberturaCheck() {
executeClean();
executeClean()
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
ByteArrayOutputStream errorStream = new ByteArrayOutputStream()
connection.newBuild()
Expand Down Expand Up @@ -235,7 +244,7 @@ class CoberturaPluginExecutionTest {
*/
@Test
void executeTestCoberturaCheckDryRun() {
executeClean();
executeClean()
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
ByteArrayOutputStream errorStream = new ByteArrayOutputStream()
connection.newBuild()
Expand Down
2 changes: 1 addition & 1 deletion testclient/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions testclient/util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ repositories {
}

dependencies {
compile 'org.codehaus.groovy:groovy-all:2.0.6'
testCompile "junit:junit:4.10"
implementation 'org.codehaus.groovy:groovy-all:2.0.6'
testImplementation "junit:junit:4.10"
}

cobertura {
Expand Down

0 comments on commit 18b9c18

Please sign in to comment.