Skip to content

Commit 925f04c

Browse files
committed
update test
1 parent 204fb8f commit 925f04c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

java-sdk-logging/logback-extension/src/test/java/com/google/api/logging/SDKLoggingMdcJsonProviderTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void init() {
3232
}
3333

3434
@Test
35-
void testWriteJsonStringToJsonTree() throws IOException {
35+
void testWriteValidJsonStringToJsonTree() throws IOException {
3636
mdc.put(
3737
"json1",
3838
"{\n"
@@ -50,7 +50,7 @@ void testWriteJsonStringToJsonTree() throws IOException {
5050
}
5151

5252
@Test
53-
void testWriteIllegalJsonFormatToString() throws IOException {
53+
void testWriteInvalidJsonStringToString() throws IOException {
5454
mdc.put(
5555
"json1",
5656
"{\n"
@@ -65,7 +65,8 @@ void testWriteIllegalJsonFormatToString() throws IOException {
6565

6666
provider.writeTo(generator, event);
6767
verify(generator).writeFieldName("json1");
68-
verify(generator, never()).writeTree(any(JsonNode.class));
6968
verify(generator).writeObject(anyString());
69+
// should not write tree node because the json string is invalid.
70+
verify(generator, never()).writeTree(any(JsonNode.class));
7071
}
7172
}

0 commit comments

Comments
 (0)