Skip to content
This repository was archived by the owner on Dec 23, 2023. It is now read-only.

Commit 5bf6916

Browse files
committed
Minor cleanup.
1 parent 1a7feea commit 5bf6916

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

core/java/com/google/census/MetricMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public MetricMap build() {
107107
return new MetricMap(metrics);
108108
}
109109

110-
private ArrayList<Metric> metrics = new ArrayList<Metric>();
110+
private final ArrayList<Metric> metrics = new ArrayList<Metric>();
111111

112112
private Builder() {
113113
}

core/javatests/com/google/census/TagTest.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,9 @@ public void testGetValue() {
3838
assertThat(new Tag("key", "val").getValue()).isEqualTo("val");
3939
}
4040

41-
@Test
41+
@Test(expected = UnsupportedOperationException.class)
4242
public void testSetValue() {
43-
boolean fail = true;
44-
try {
45-
new Tag("key", "val").setValue("val1");
46-
fail = false;
47-
} catch (UnsupportedOperationException expected) {
48-
}
49-
assertThat(fail).isTrue();
43+
new Tag("key", "val").setValue("val1");
5044
}
5145

5246
@Test

examples/java/com/google/census/CensusRunner.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@
1111
* limitations under the License.
1212
*/
1313

14-
package com.google.census.examples;
15-
16-
import com.google.census.Census;
17-
import com.google.census.CensusContext;
18-
import com.google.census.CensusGrpcContext;
19-
import com.google.census.MetricMap;
20-
import com.google.census.MetricName;
21-
import com.google.census.TagKey;
22-
import com.google.census.TagValue;
14+
package com.google.census;
2315

2416
import io.grpc.Context;
2517

18+
/**
19+
* Simple program that uses Census contexts.
20+
*/
2621
public class CensusRunner {
2722
private static final TagKey K1 = new TagKey("k1");
2823
private static final TagKey K2 = new TagKey("k2");
@@ -37,7 +32,7 @@ public class CensusRunner {
3732
private static final MetricName M1 = new MetricName("m1");
3833
private static final MetricName M2 = new MetricName("m2");
3934

40-
public static void main(String args[]) {
35+
public static void main(String[] args) {
4136
System.out.println("Hello Census World");
4237
System.out.println("Default Tags: " + DEFAULT);
4338
System.out.println("Current Tags: " + getCurrentCensusContext());

0 commit comments

Comments
 (0)