Commit Graph

12 Commits

Author SHA1 Message Date
Maicol 49b00d1a86
Port all Junit assert to Truth asserts (#2304)
* Port Junit assert to Truth in `com.google.gson.stream`

* Port Junit assert to Truth in `com.google.gson.regression`

* Port Junit assert to Truth in `om.google.gson.reflect`

* Port Junit assert to Truth in `com.google.gson.metrics`

* Port Junit assert to Truth in `com.google.gson.internal`

* Port Junit assert to Truth in `com.google.gson.internal.sql`

* Port Junit assert to Truth in `com.google.gson.internal.reflect`

* Port Junit assert to Truth in `com.google.gson.internal.bind`

* Port Junit assert to Truth in `com.google.gson.internal.bind.util`

* Port Junit assert to Truth in `com.google.gson.functional`

* Replaces `List.of` with `Arrays.asList` to grant legacy

* Simplify `==` asserts

* Simplify `.contain()` asserts + Minor fixes

* Simplify asserts
2023-01-31 11:20:54 -08:00
Maicol 1a2170b99c
Port tests from JUnit 3 to JUnit 4 (#2294)
* Port tests from JUnit 3 to JUnit 4

* Port tests from JUnit 3 to JUnit 4

* Add `@Test` above `@Ignore`
2022-12-22 06:04:16 -08:00
Inderjeet Singh e5b3f6368d updated minimum JDK version to 1.6.
Added Overrides for methods implementing an interface.
2015-11-04 18:52:20 -08:00
Jesse Wilson 641590b5b6 Fill in some gaps in ExclusionStrategy's test.
Changes to GsonInternalAccess should have broken exclusion strategies, but didn't. Adding these tests cause the expected breaks.
2012-01-01 12:34:47 +00:00
Jesse Wilson 25c6ae177b Down to 22 failing tests.
Consolidated all of the different code paths that we use to construct instances. We now have an ObjectConstructor class that knows what type it constructs; this means that we don't need to ever do reflection to lookup a constructor at construction time.

Cleaned up some buggy type adapters, particularly around handling of null.

Removed dead code for object graph navigation.

Moved some classes into 'internal' so they are visible to the 'bind' subpackage.

Turned some TypeAdapterFactory/TypeAdapter pairs inside out so that the TypeAdapter is now the inner class. This is necessary so that the factories can take parameters.

Added an API to request the 'next' type adapter for a type. This allows type adapters to compose other type adapters. We're using this in two places:
 - where the user has excluded a type from serialization but not deserialization, we need to use the "default" deserialization but interpose null on serialization. We create a type adapter that delegates for one and returns null for the other.
 - similarly when a DOM type serializer is registered but no deserializer, or vice versa.
This is the biggest change to the MiniGson core.

For backwards compatibility, return null for the empty string.

Simplify JsonSerializationContext/JsonDeserializationContext to simply call through to GSON. SerializeDefault is currently unsupported.

More useful error messages when calling getAsBoolean on a JsonNull.

Remove currently unused MemoryRefStack. We might need this back again, though wiring it back in will be much more difficult because we don't interject ourselves between the users' various type adapters.
2011-09-11 07:04:56 +00:00
Joel Leitch 49e7ee05fc Fix method name by making it singular. 2011-04-11 18:44:19 +00:00
Inderjeet Singh 542a17c3bc Incorporated comments from r710 2011-04-04 22:48:34 +00:00
Inderjeet Singh 52288d7127 rawtypes -> unchecked
Fixed spurious eclipse warnings on deprecation, missing classes or parameters, etc.
2011-02-24 22:47:55 +00:00
Joel Leitch 69661216a3 Minor clean-up of warnings (in 1.5) and added new test for non-Empty maps. 2011-02-11 18:22:58 +00:00
Joel Leitch 114633fbf9 Provide a means to add serialization or deserialization specific exclusion strategies. 2011-02-04 03:09:41 +00:00
Joel Leitch b883f8f4aa Add new "Mode" enum and carry mode through Gson so exclusion strategies know whether it is currently serializing or deserializing.
Deprecate old ExclusionStrategy code since this new approach is more powerful.
2011-01-22 22:15:06 +00:00
Joel Leitch d87d3f807f Added functional tests for user defined exclusion strategy.
Added test to ensure empty/null properties are added for the JsonObject.
2009-10-09 21:12:07 +00:00