aboutsummaryrefslogtreecommitdiffstats
path: root/api/src/test
diff options
context:
space:
mode:
authorKristen Kozak <sebright@google.com>2017-11-13 19:01:47 -0800
committerKristen Kozak <sebright@google.com>2017-11-13 19:54:33 -0800
commitc39d244ca356ee2bbbb9a2eaf7323d3d468dbee7 (patch)
treec417cf1e54f070a9ef5e0eaccdc5f1ba8554208e /api/src/test
parent8b849436310c298b3293211f748f3bb6d227ff63 (diff)
downloadplatform_external_opencensus-java-c39d244ca356ee2bbbb9a2eaf7323d3d468dbee7.tar.gz
platform_external_opencensus-java-c39d244ca356ee2bbbb9a2eaf7323d3d468dbee7.tar.bz2
platform_external_opencensus-java-c39d244ca356ee2bbbb9a2eaf7323d3d468dbee7.zip
Enable new ReturnMissingNullable Error Prone experimental suggestion.
I also added some missing Nullable annotations.
Diffstat (limited to 'api/src/test')
-rw-r--r--api/src/test/java/io/opencensus/tags/TagContextTest.java2
-rw-r--r--api/src/test/java/io/opencensus/trace/AttributeValueTest.java10
2 files changed, 12 insertions, 0 deletions
diff --git a/api/src/test/java/io/opencensus/tags/TagContextTest.java b/api/src/test/java/io/opencensus/tags/TagContextTest.java
index 813e1a76..7243720c 100644
--- a/api/src/test/java/io/opencensus/tags/TagContextTest.java
+++ b/api/src/test/java/io/opencensus/tags/TagContextTest.java
@@ -23,6 +23,7 @@ import com.google.common.testing.EqualsTester;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import javax.annotation.Nullable;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -94,6 +95,7 @@ public final class TagContextTest {
}
@Override
+ @Nullable
protected Iterator<Tag> getIterator() {
return tags == null ? null : tags.iterator();
}
diff --git a/api/src/test/java/io/opencensus/trace/AttributeValueTest.java b/api/src/test/java/io/opencensus/trace/AttributeValueTest.java
index b7e0afbd..e505c59b 100644
--- a/api/src/test/java/io/opencensus/trace/AttributeValueTest.java
+++ b/api/src/test/java/io/opencensus/trace/AttributeValueTest.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.fail;
import com.google.common.testing.EqualsTester;
import io.opencensus.common.Function;
import io.opencensus.common.Functions;
+import javax.annotation.Nullable;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -35,6 +36,7 @@ public class AttributeValueTest {
attribute.match(
new Function<String, Object>() {
@Override
+ @Nullable
public Object apply(String stringValue) {
assertThat(stringValue).isEqualTo("MyStringAttributeValue");
return null;
@@ -42,6 +44,7 @@ public class AttributeValueTest {
},
new Function<Boolean, Object>() {
@Override
+ @Nullable
public Object apply(Boolean booleanValue) {
fail("Expected a String");
return null;
@@ -49,6 +52,7 @@ public class AttributeValueTest {
},
new Function<Long, Object>() {
@Override
+ @Nullable
public Object apply(Long longValue) {
fail("Expected a String");
return null;
@@ -63,6 +67,7 @@ public class AttributeValueTest {
attribute.match(
new Function<String, Object>() {
@Override
+ @Nullable
public Object apply(String stringValue) {
fail("Expected a Boolean");
return null;
@@ -70,6 +75,7 @@ public class AttributeValueTest {
},
new Function<Boolean, Object>() {
@Override
+ @Nullable
public Object apply(Boolean booleanValue) {
assertThat(booleanValue).isTrue();
return null;
@@ -77,6 +83,7 @@ public class AttributeValueTest {
},
new Function<Long, Object>() {
@Override
+ @Nullable
public Object apply(Long longValue) {
fail("Expected a Boolean");
return null;
@@ -91,6 +98,7 @@ public class AttributeValueTest {
attribute.match(
new Function<String, Object>() {
@Override
+ @Nullable
public Object apply(String stringValue) {
fail("Expected a Long");
return null;
@@ -98,6 +106,7 @@ public class AttributeValueTest {
},
new Function<Boolean, Object>() {
@Override
+ @Nullable
public Object apply(Boolean booleanValue) {
fail("Expected a Long");
return null;
@@ -105,6 +114,7 @@ public class AttributeValueTest {
},
new Function<Long, Object>() {
@Override
+ @Nullable
public Object apply(Long longValue) {
assertThat(longValue).isEqualTo(123456L);
return null;