Added a test to ensure that Gson handles repeated invocation of itself correctly.

Revised proto maven configuration to use Gson 1.6
This commit is contained in:
Inderjeet Singh 2010-11-15 22:56:01 +00:00
parent 371befafa3
commit 279649986e
2 changed files with 9 additions and 1 deletions

View File

@ -81,4 +81,12 @@ public class EscapingTest extends TestCase {
assertEquals(target, noEscapeHtmlGson.fromJson(escapedJsonForm, BagOfPrimitives.class)); assertEquals(target, noEscapeHtmlGson.fromJson(escapedJsonForm, BagOfPrimitives.class));
assertEquals(target, escapeHtmlGson.fromJson(nonEscapedJsonForm, BagOfPrimitives.class)); assertEquals(target, escapeHtmlGson.fromJson(nonEscapedJsonForm, BagOfPrimitives.class));
} }
public void testGsonDoubleDeserialization() {
BagOfPrimitives expected = new BagOfPrimitives(3L, 4, true, "value1");
String json = gson.toJson(gson.toJson(expected));
String value = gson.fromJson(json, String.class);
BagOfPrimitives actual = gson.fromJson(value, BagOfPrimitives.class);
assertEquals(expected, actual);
}
} }

View File

@ -52,7 +52,7 @@
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>1.5</version> <version>1.6</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>