aboutsummaryrefslogtreecommitdiff
path: root/api/src/test/java/io/opencensus
diff options
context:
space:
mode:
authorYang Song <songy23@users.noreply.github.com>2018-09-18 16:25:14 -0700
committerGitHub <noreply@github.com>2018-09-18 16:25:14 -0700
commit7da904c4e75d68eaf77ecaca59e82fa932251e0c (patch)
treefacb0f32924df0ad6d60a0d1cc54dc101c22efd7 /api/src/test/java/io/opencensus
parent0a3fb9761fbc0d31e06a60dcb650c9e9a8d5f5f3 (diff)
downloadopencensus-java-7da904c4e75d68eaf77ecaca59e82fa932251e0c.tar.gz
Common: Add an API Functions.returnToString(). (#1443)
* Common: Add an API Functions.returnToString(). * Fix comments and add tests.
Diffstat (limited to 'api/src/test/java/io/opencensus')
-rw-r--r--api/src/test/java/io/opencensus/common/FunctionsTest.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/api/src/test/java/io/opencensus/common/FunctionsTest.java b/api/src/test/java/io/opencensus/common/FunctionsTest.java
index e4d37569..55d58d4d 100644
--- a/api/src/test/java/io/opencensus/common/FunctionsTest.java
+++ b/api/src/test/java/io/opencensus/common/FunctionsTest.java
@@ -40,6 +40,14 @@ public class FunctionsTest {
}
@Test
+ public void testReturnToString() {
+ assertThat(Functions.returnToString().apply("input")).isEqualTo("input");
+ assertThat(Functions.returnToString().apply(Boolean.FALSE)).isEqualTo("false");
+ assertThat(Functions.returnToString().apply(Double.valueOf(123.45))).isEqualTo("123.45");
+ assertThat(Functions.returnToString().apply(null)).isEqualTo(null);
+ }
+
+ @Test
public void testThrowIllegalArgumentException() {
Function<Object, Void> f = Functions.throwIllegalArgumentException();
thrown.expect(IllegalArgumentException.class);