|
1 |
| -/** |
| 1 | +/* |
2 | 2 | * Copyright 2015 Google Inc. All Rights Reserved.
|
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 | 16 |
|
17 |
| -import static com.jcabi.matchers.RegexMatchers.*; |
18 |
| -import static org.junit.Assert.*; |
| 17 | +import static com.google.common.truth.Truth.assertThat; |
19 | 18 |
|
20 | 19 | import org.junit.After;
|
21 | 20 | import org.junit.Before;
|
22 | 21 | import org.junit.Test;
|
23 | 22 |
|
24 | 23 | import java.io.ByteArrayOutputStream;
|
25 | 24 | import java.io.PrintStream;
|
26 |
| -import java.util.regex.Pattern; |
27 | 25 |
|
28 | 26 | /**
|
29 | 27 | * Tests the Cloud Monitoring auth sample.
|
@@ -51,15 +49,19 @@ public void tearDown() {
|
51 | 49 | @Test
|
52 | 50 | public void testUsage() throws Exception {
|
53 | 51 | CloudMonitoringAuthSample.main(new String[] { });
|
54 |
| - assertEquals("Usage: CloudMonitoringAuthSample <project-name>\n", stderr.toString()); |
| 52 | + assertThat(stderr.toString()) |
| 53 | + .named("stderr") |
| 54 | + .isEqualTo("Usage: CloudMonitoringAuthSample <project-name>\n"); |
55 | 55 | }
|
56 | 56 |
|
57 | 57 | @Test
|
58 | 58 | public void testListTimeSeries() throws Exception {
|
59 | 59 | CloudMonitoringAuthSample.main(new String[] { "cloud-samples-tests" });
|
60 | 60 | String out = stdout.toString();
|
61 |
| - assertThat(out, containsPattern("Timeseries.list raw response:")); |
62 |
| - assertThat(out, containsPattern("\\{\\s*\"kind\" *: *\"cloudmonitoring#listTimeseriesResponse\",")); |
63 |
| - assertThat(out, containsPattern(".*oldest.*")); |
| 61 | + assertThat(out).named("stdout").contains("Timeseries.list raw response:"); |
| 62 | + assertThat(out) |
| 63 | + .named("stdout") |
| 64 | + .containsMatch("\\{\\s*\"kind\" *: *\"cloudmonitoring#listTimeseriesResponse\","); |
| 65 | + assertThat(out).named("stdout").containsMatch(".*oldest.*"); |
64 | 66 | }
|
65 | 67 | }
|
0 commit comments