diff options
author | gjoranv <gv@verizonmedia.com> | 2020-01-23 12:39:19 +0100 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2020-01-23 12:40:04 +0100 |
commit | 6be753f4021e5ef8ece22d19898dbb18e0005bf4 (patch) | |
tree | 4bd83c8464b07d6234955964f37a2fb38637d895 /container-core/src/test/java/com/yahoo/container/handler | |
parent | b492c6d6b5f46bc484d249ef5aa3768d7dd91c71 (diff) |
Move metrics handler utilities to new package in container-core
Diffstat (limited to 'container-core/src/test/java/com/yahoo/container/handler')
-rw-r--r-- | container-core/src/test/java/com/yahoo/container/handler/metrics/ErrorResponseTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/container-core/src/test/java/com/yahoo/container/handler/metrics/ErrorResponseTest.java b/container-core/src/test/java/com/yahoo/container/handler/metrics/ErrorResponseTest.java new file mode 100644 index 00000000000..882f9044dce --- /dev/null +++ b/container-core/src/test/java/com/yahoo/container/handler/metrics/ErrorResponseTest.java @@ -0,0 +1,25 @@ +// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.container.handler.metrics; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * @author gjoranv + */ +public class ErrorResponseTest { + + @Test + public void error_message_is_wrapped_in_json_object() { + var json = ErrorResponse.asErrorJson("bad"); + assertEquals("{\"error\":\"bad\"}", json); + } + + @Test + public void quotes_are_escaped() { + var json = ErrorResponse.asErrorJson("Message \" with \" embedded quotes."); + assertEquals("{\"error\":\"Message \\\" with \\\" embedded quotes.\"}", json); + } + +} |