diff options
author | Kevin Sawicki | 2011-09-29 17:26:44 +0000 |
---|---|---|
committer | Kevin Sawicki | 2011-09-29 17:26:44 +0000 |
commit | a0915c82b295724c0ff6be52af69614269bc21ec (patch) | |
tree | 71da4063275d70f014656464a453715dae1e2cbb /org.eclipse.egit.github.core.tests/src | |
parent | 96a7d18da0a14ad936a8e93a71427966c4f8810d (diff) | |
download | egit-github-a0915c82b295724c0ff6be52af69614269bc21ec.tar.gz egit-github-a0915c82b295724c0ff6be52af69614269bc21ec.tar.xz egit-github-a0915c82b295724c0ff6be52af69614269bc21ec.zip |
Support 'custom' code when formatting field errors
Change-Id: Icdda0a67ab14f44121c95276a1b80851c3a2cfb4
Signed-off-by: Kevin Sawicki <kevin@github.com>
Diffstat (limited to 'org.eclipse.egit.github.core.tests/src')
-rw-r--r-- | org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RequestExceptionTest.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RequestExceptionTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RequestExceptionTest.java index 8aa2c423..e81196b9 100644 --- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RequestExceptionTest.java +++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/RequestExceptionTest.java @@ -99,4 +99,19 @@ public class RequestExceptionTest { assertEquals("400: Error with 'priority' field in Gist resource", formatted); } + + /** + * Formatted error message for custom error code that contains message + */ + @Test + public void customCode() { + RequestError error = GsonUtils + .fromJson( + "{\"errors\":[{\"code\":\"custom\", \"message\":\"Integer instead of String\"}]}", + RequestError.class); + RequestException e = new RequestException(error, 400); + String formatted = e.formatErrors(); + assertNotNull(formatted); + assertEquals("400: Integer instead of String", formatted); + } } |