From 7d96ce8d6d53db959664453e91d5b457f78dca86 Mon Sep 17 00:00:00 2001 From: Inderjeet Singh Date: Wed, 10 Dec 2014 22:43:44 +0000 Subject: [PATCH] fixed tests to take care of stackTrace element appearing sometimes --- .../com/google/gson/functional/ThrowableFunctionalTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gson/src/test/java/com/google/gson/functional/ThrowableFunctionalTest.java b/gson/src/test/java/com/google/gson/functional/ThrowableFunctionalTest.java index ab97400f..f6ae748a 100644 --- a/gson/src/test/java/com/google/gson/functional/ThrowableFunctionalTest.java +++ b/gson/src/test/java/com/google/gson/functional/ThrowableFunctionalTest.java @@ -24,7 +24,7 @@ public final class ThrowableFunctionalTest extends TestCase { public void testExceptionWithCause() { Exception e = new Exception("top level", new IOException("io error")); String json = gson.toJson(e); - assertEquals("{\"detailMessage\":\"top level\",\"cause\":{\"detailMessage\":\"io error\"}}", json); + assertTrue(json.contains("{\"detailMessage\":\"top level\",\"cause\":{\"detailMessage\":\"io error\"")); e = gson.fromJson("{'detailMessage':'top level','cause':{'detailMessage':'io error'}}", Exception.class); assertEquals("top level", e.getMessage()); @@ -35,7 +35,7 @@ public final class ThrowableFunctionalTest extends TestCase { public void testSerializedNameOnExceptionFields() { MyException e = new MyException(); String json = gson.toJson(e); - assertEquals("{\"my_custom_name\":\"myCustomMessageValue\"}", json); + assertTrue(json.contains("{\"my_custom_name\":\"myCustomMessageValue\"")); } public void testErrorWithoutCause() {