Skip to content

Commit 23bef55

Browse files
authored
deps: Bump testing libraries to their latest possible versions (#449)
* Dependency version bumps: - Bump commons-io from 2.4 to 2.11.0 - Bump junit from 4.12 to 4.13 - Bump hamcrest-library from 1.3 to 2.2 - Bump mockito-core from 2.11.0 to 4.11.0 - Bump jacoco from 0.8.6 to 0.8.8 - Bump checkstyle from 8.18 to 8.37 * Have `verifyGoogleFormat` task run before checkstyle tasks (to suggest fixing via `./gradlew googleJavaFormat`)
1 parent d1d34c0 commit 23bef55

File tree

8 files changed

+39
-29
lines changed

8 files changed

+39
-29
lines changed

app-gradle-plugin/build.gradle.kts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ dependencies {
4545
implementation(gradleApi())
4646
api("com.google.cloud.tools:appengine-plugins-core:0.9.9")
4747

48-
testImplementation("commons-io:commons-io:2.4")
49-
testImplementation("junit:junit:4.12")
50-
testImplementation("org.hamcrest:hamcrest-library:1.3")
51-
testImplementation("org.mockito:mockito-core:2.23.4")
48+
testImplementation("commons-io:commons-io:2.11.0")
49+
testImplementation("junit:junit:4.13.2")
50+
testImplementation("org.hamcrest:hamcrest-library:2.2")
51+
testImplementation("org.mockito:mockito-core:4.11.0")
5252
}
5353

5454

@@ -192,11 +192,16 @@ googleJavaFormat {
192192
tasks.check.configure {
193193
dependsOn(tasks.verifyGoogleJavaFormat)
194194
}
195+
tasks.withType<Checkstyle>().configureEach {
196+
// Set up a soft dependency so that verifyGoogleFormat suggests running googleJavaFormat,
197+
// before devs start fixing individual checkstyle violations manually.
198+
shouldRunAfter(tasks.verifyGoogleJavaFormat)
199+
}
195200
// to auto-format run ./gradlew googleJavaFormat
196201

197202
checkstyle {
198-
toolVersion = "8.18"
199-
// get the google_checks.xml file from the actual tool we"re invoking)
203+
toolVersion = "8.37"
204+
// Get the google_checks.xml file from the actual tool we're invoking.
200205
config = resources.text.fromArchiveEntry(configurations.checkstyle.get().files.first(), "google_checks.xml")
201206
maxErrors = 0
202207
maxWarnings = 0
@@ -208,7 +213,7 @@ checkstyle {
208213

209214
/* TEST COVERAGE */
210215
jacoco {
211-
toolVersion = "0.8.6"
216+
toolVersion = "0.8.8"
212217
}
213218

214219
tasks.jacocoTestReport {

app-gradle-plugin/src/integTest/java/com/google/cloud/tools/gradle/appengine/AppEngineAppYamlPluginIntegrationTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.gradle.testkit.runner.BuildResult;
3232
import org.gradle.testkit.runner.GradleRunner;
3333
import org.hamcrest.CoreMatchers;
34-
import org.junit.Assert;
34+
import org.hamcrest.MatcherAssert;
3535
import org.junit.Before;
3636
import org.junit.Rule;
3737
import org.junit.Test;
@@ -63,7 +63,7 @@ public void testDeploy()
6363
.withArguments("appengineDeploy")
6464
.build();
6565

66-
Assert.assertThat(
66+
MatcherAssert.assertThat(
6767
buildResult.getOutput(), CoreMatchers.containsString("Deployed service [appyaml-project]"));
6868

6969
deleteProject();
@@ -81,18 +81,18 @@ public void testDeployAll()
8181
.withArguments("appengineDeployAll")
8282
.build();
8383

84-
Assert.assertThat(
84+
MatcherAssert.assertThat(
8585
buildResult.getOutput(), CoreMatchers.containsString("Deployed service [appyaml-project]"));
86-
Assert.assertThat(
86+
MatcherAssert.assertThat(
8787
buildResult.getOutput(), CoreMatchers.containsString("Custom routings have been updated."));
88-
Assert.assertThat(
88+
MatcherAssert.assertThat(
8989
buildResult.getOutput(), CoreMatchers.containsString("DoS protection has been updated."));
90-
Assert.assertThat(
90+
MatcherAssert.assertThat(
9191
buildResult.getOutput(),
9292
CoreMatchers.containsString("Indexes are being rebuilt. This may take a moment."));
93-
Assert.assertThat(
93+
MatcherAssert.assertThat(
9494
buildResult.getOutput(), CoreMatchers.containsString("Cron jobs have been updated."));
95-
Assert.assertThat(
95+
MatcherAssert.assertThat(
9696
buildResult.getOutput(), CoreMatchers.containsString("Task queues have been updated."));
9797

9898
deleteProject();

app-gradle-plugin/src/integTest/java/com/google/cloud/tools/gradle/appengine/AppEngineStandardPluginIntegrationTest.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
import com.google.cloud.tools.managedcloudsdk.UnsupportedOsException;
2727
import java.io.File;
2828
import java.io.IOException;
29+
import java.nio.charset.Charset;
2930
import java.nio.file.Path;
3031
import java.util.Arrays;
3132
import org.apache.commons.io.FileUtils;
3233
import org.gradle.testkit.runner.BuildResult;
3334
import org.gradle.testkit.runner.GradleRunner;
3435
import org.hamcrest.CoreMatchers;
36+
import org.hamcrest.MatcherAssert;
3537
import org.junit.After;
3638
import org.junit.Assert;
3739
import org.junit.Before;
@@ -131,7 +133,8 @@ public void testDevAppServer_async() throws InterruptedException, IOException {
131133

132134
Assert.assertEquals(1, expectedLogFileDir.listFiles().length);
133135
File devAppserverLogFile = new File(expectedLogFileDir, "dev_appserver.out");
134-
String devAppServerOutput = FileUtils.readFileToString(devAppserverLogFile);
136+
String devAppServerOutput =
137+
FileUtils.readFileToString(devAppserverLogFile, Charset.defaultCharset());
135138
Assert.assertTrue(devAppServerOutput.contains(devAppServerStartedString));
136139

137140
AssertConnection.assertResponse(
@@ -157,7 +160,7 @@ public void testDeploy()
157160
.withArguments("appengineDeploy", "--stacktrace")
158161
.build();
159162

160-
Assert.assertThat(
163+
MatcherAssert.assertThat(
161164
buildResult.getOutput(),
162165
CoreMatchers.containsString("Deployed service [standard-project]"));
163166

@@ -175,19 +178,19 @@ public void testDeployAll()
175178
.withArguments("appengineDeployAll")
176179
.build();
177180

178-
Assert.assertThat(
181+
MatcherAssert.assertThat(
179182
buildResult.getOutput(),
180183
CoreMatchers.containsString("Deployed service [standard-project]"));
181-
Assert.assertThat(
184+
MatcherAssert.assertThat(
182185
buildResult.getOutput(), CoreMatchers.containsString("Custom routings have been updated."));
183-
Assert.assertThat(
186+
MatcherAssert.assertThat(
184187
buildResult.getOutput(), CoreMatchers.containsString("DoS protection has been updated."));
185-
Assert.assertThat(
188+
MatcherAssert.assertThat(
186189
buildResult.getOutput(),
187190
CoreMatchers.containsString("Indexes are being rebuilt. This may take a moment."));
188-
Assert.assertThat(
191+
MatcherAssert.assertThat(
189192
buildResult.getOutput(), CoreMatchers.containsString("Cron jobs have been updated."));
190-
Assert.assertThat(
193+
MatcherAssert.assertThat(
191194
buildResult.getOutput(), CoreMatchers.containsString("Task queues have been updated."));
192195

193196
deleteProject();

app-gradle-plugin/src/integTest/java/com/google/cloud/tools/gradle/appengine/AssertConnection.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.net.HttpURLConnection;
2525
import java.net.URL;
2626
import org.hamcrest.CoreMatchers;
27+
import org.hamcrest.MatcherAssert;
2728
import org.junit.Assert;
2829

2930
/** Assertions for checking connections web apps. */
@@ -36,7 +37,7 @@ public static void assertResponse(String url, int expectedCode, String expectedT
3637
int responseCode = urlConnection.getResponseCode();
3738
Assert.assertEquals(expectedCode, responseCode);
3839
String response = CharStreams.toString(new InputStreamReader(urlConnection.getInputStream()));
39-
Assert.assertThat(response, CoreMatchers.equalTo(expectedText));
40+
MatcherAssert.assertThat(response, CoreMatchers.equalTo(expectedText));
4041
} catch (IOException e) {
4142
Assert.fail("IOException while running test");
4243
}
@@ -73,7 +74,7 @@ public static void assertResponseWithRetries(
7374

7475
// Will only reach this point when a response is reached
7576
Assert.assertEquals(expectedCode, responseCode);
76-
Assert.assertThat(response, CoreMatchers.equalTo(expectedText));
77+
MatcherAssert.assertThat(response, CoreMatchers.equalTo(expectedText));
7778
return;
7879

7980
} catch (IOException ex) {

app-gradle-plugin/src/test/java/com/google/cloud/tools/gradle/appengine/AppEnginePluginTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
import static org.hamcrest.CoreMatchers.containsString;
2121
import static org.hamcrest.CoreMatchers.not;
22+
import static org.hamcrest.MatcherAssert.assertThat;
2223
import static org.junit.Assert.assertFalse;
23-
import static org.junit.Assert.assertThat;
2424
import static org.junit.Assert.assertTrue;
2525
import static org.junit.Assume.assumeTrue;
2626

app-gradle-plugin/src/test/java/com/google/cloud/tools/gradle/appengine/appyaml/AppEngineAppYamlPluginTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
package com.google.cloud.tools.gradle.appengine.appyaml;
1919

2020
import static org.hamcrest.CoreMatchers.containsString;
21+
import static org.hamcrest.MatcherAssert.assertThat;
2122
import static org.junit.Assert.assertEquals;
2223
import static org.junit.Assert.assertFalse;
23-
import static org.junit.Assert.assertThat;
2424
import static org.junit.Assert.assertTrue;
2525
import static org.junit.Assume.assumeTrue;
2626

app-gradle-plugin/src/test/java/com/google/cloud/tools/gradle/appengine/core/AppEngineCorePluginConfigurationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.IOException;
2222
import java.util.List;
2323
import org.gradle.api.Project;
24+
import org.hamcrest.MatcherAssert;
2425
import org.hamcrest.Matchers;
2526
import org.junit.Assert;
2627
import org.junit.Rule;
@@ -44,7 +45,7 @@ public void testCreateDownloadSdkTask_configureAppEngineComponent() throws IOExc
4445
.getTasks()
4546
.getByPath(AppEngineCorePluginConfiguration.DOWNLOAD_CLOUD_SDK_TASK_NAME);
4647
List<SdkComponent> components = task.getComponents();
47-
Assert.assertThat(components, Matchers.hasItem(SdkComponent.APP_ENGINE_JAVA));
48+
MatcherAssert.assertThat(components, Matchers.hasItem(SdkComponent.APP_ENGINE_JAVA));
4849
Assert.assertEquals(1, components.size());
4950
}
5051

app-gradle-plugin/src/test/java/com/google/cloud/tools/gradle/appengine/standard/AppEngineStandardPluginTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
package com.google.cloud.tools.gradle.appengine.standard;
1919

2020
import static org.hamcrest.CoreMatchers.containsString;
21+
import static org.hamcrest.MatcherAssert.assertThat;
2122
import static org.junit.Assert.assertEquals;
2223
import static org.junit.Assert.assertFalse;
23-
import static org.junit.Assert.assertThat;
2424
import static org.junit.Assume.assumeTrue;
2525

2626
import com.google.cloud.tools.gradle.appengine.BuildResultFilter;

0 commit comments

Comments
 (0)