From 100324f4dc9a48822929fc3a86bb0b70e8718d37 Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Thu, 31 Jan 2019 18:47:19 -0800 Subject: [PATCH] one more test --- .../gax/httpjson/ApiMessageHttpRequestTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gax-httpjson/src/test/java/com/google/api/gax/httpjson/ApiMessageHttpRequestTest.java b/gax-httpjson/src/test/java/com/google/api/gax/httpjson/ApiMessageHttpRequestTest.java index 05e99fbe4..c14573b1a 100644 --- a/gax-httpjson/src/test/java/com/google/api/gax/httpjson/ApiMessageHttpRequestTest.java +++ b/gax-httpjson/src/test/java/com/google/api/gax/httpjson/ApiMessageHttpRequestTest.java @@ -81,6 +81,21 @@ public void testFieldMask() throws IOException { .isEqualTo("{\"name\":\"tree_frog\",\"limbs\":[\"legs\"],\"poisonous\":null}"); } + @Test + public void testPartialFieldMask() throws IOException { + List fieldMask = Lists.newArrayList("name", "poisonous"); + FrogMessage frogMessage = new FrogMessage("tree_frog", 4, Lists.newArrayList("legs"), null); + + InsertFrogRequest insertFrogRequest = + new InsertFrogRequest("name/tree_frog", "request57", frogMessage, fieldMask); + + OutputStream outputStream = insertFrog(insertFrogRequest); + + // JSON content string must contain all and ONLY the fields in fieldMask, even if the value is null. + Truth.assertThat(outputStream.toString()) + .isEqualTo("{\"name\":\"tree_frog\",\"poisonous\":null}"); + } + @Test public void testNullFieldMask() throws IOException { List nullFieldMask = null;