Skip to content

Commit df01002

Browse files
committed
Upgrade to Gradle 4.9
1 parent df5c5b1 commit df01002

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

gradle/wrapper/gradle-wrapper.jar

-4 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ErrorShouldRethrow.java

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,17 @@
1515
*/
1616
package com.diffplug.gradle.spotless;
1717

18+
import static org.assertj.core.api.Assertions.assertThat;
19+
1820
import java.io.IOException;
1921
import java.util.ArrayList;
2022
import java.util.Arrays;
2123
import java.util.List;
2224

23-
import org.assertj.core.api.Assertions;
2425
import org.gradle.testkit.runner.BuildResult;
2526
import org.gradle.testkit.runner.TaskOutcome;
2627
import org.junit.Test;
2728

28-
import com.diffplug.common.base.CharMatcher;
29-
import com.diffplug.common.base.Splitter;
30-
import com.diffplug.common.base.StringPrinter;
3129
import com.diffplug.spotless.LineEnding;
3230

3331
/** Tests the desired behavior from https://github.com/diffplug/spotless/issues/46. */
@@ -67,8 +65,8 @@ public void anyExceptionShouldFail() throws Exception {
6765
"} // spotless");
6866
setFile("README.md").toContent("This code is fubar.");
6967
runWithFailure(
70-
":spotlessMiscStep 'no swearing' found problem in 'README.md':",
71-
"No swearing!",
68+
":spotlessMisc",
69+
"Step 'no swearing' found problem in 'README.md'",
7270
"java.lang.RuntimeException: No swearing!");
7371
}
7472

@@ -79,7 +77,7 @@ public void unlessEnforceCheckIsFalse() throws Exception {
7977
" enforceCheck false",
8078
"} // spotless");
8179
setFile("README.md").toContent("This code is fubar.");
82-
runWithSuccess(":compileJava UP-TO-DATE");
80+
runWithSuccess(":compileJava NO-SOURCE");
8381
}
8482

8583
@Test
@@ -113,28 +111,25 @@ public void failsIfNeitherStepNorFileExempted() throws Exception {
113111
"} // spotless");
114112
setFile("README.md").toContent("This code is fubar.");
115113
runWithFailure(
116-
":spotlessMiscStep 'no swearing' found problem in 'README.md':",
117-
"No swearing!",
114+
":spotlessMisc",
115+
"Step 'no swearing' found problem in 'README.md'",
118116
"java.lang.RuntimeException: No swearing!");
119117
}
120118

121-
private void runWithSuccess(String... messages) throws Exception {
119+
private void runWithSuccess(String... messagePartsInOrder) throws Exception {
122120
BuildResult result = gradleRunner().withArguments("check").build();
123-
assertResultAndMessages(result, TaskOutcome.SUCCESS, messages);
121+
assertResultAndOutputContainsMessages(result, TaskOutcome.SUCCESS, messagePartsInOrder);
124122
}
125123

126-
private void runWithFailure(String... messages) throws Exception {
124+
private void runWithFailure(String... messagePartsInOrder) throws Exception {
127125
BuildResult result = gradleRunner().withArguments("check").buildAndFail();
128-
assertResultAndMessages(result, TaskOutcome.FAILED, messages);
126+
assertResultAndOutputContainsMessages(result, TaskOutcome.FAILED, messagePartsInOrder);
129127
}
130128

131-
private void assertResultAndMessages(BuildResult result, TaskOutcome outcome, String... messages) {
132-
String expectedToStartWith = StringPrinter.buildStringFromLines(messages).trim();
133-
int numNewlines = CharMatcher.is('\n').countIn(expectedToStartWith);
134-
List<String> actualLines = Splitter.on('\n').splitToList(LineEnding.toUnix(result.getOutput()));
135-
String actualStart = String.join("\n", actualLines.subList(0, numNewlines + 1));
136-
Assertions.assertThat(actualStart).isEqualTo(expectedToStartWith);
137-
Assertions.assertThat(result.tasks(outcome).size() + result.tasks(TaskOutcome.UP_TO_DATE).size())
129+
private void assertResultAndOutputContainsMessages(BuildResult result, TaskOutcome outcome, String... messagePartsInOrder) {
130+
String actualOutput = LineEnding.toUnix(result.getOutput());
131+
assertThat(actualOutput).containsSequence(messagePartsInOrder);
132+
assertThat(result.tasks(outcome).size() + result.tasks(TaskOutcome.UP_TO_DATE).size() + result.tasks(TaskOutcome.NO_SOURCE).size())
138133
.isEqualTo(result.getTasks().size());
139134
}
140135
}

0 commit comments

Comments
 (0)