Commit Graph

21 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
Marcono1234 4dda4ec5ba
Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07:00
Marcono1234 b5343ba96c
Add tests for enum constant toString() reading (#2080) 2022-02-21 14:53:59 -08:00
Marcono1234 565b7a198e
Support EnumMap deserialization (#2071) 2022-02-04 07:20:32 -08:00
Marcono1234 b0595c595b
Fix failing to serialize Collection or Map with inaccessible constructor (#1902)
* Remove UnsafeReflectionAccessor

Revert #1218

Usage of sun.misc.Unsafe to change internal AccessibleObject.override field
to suppress JPMS warnings goes against the intentions of the JPMS and does not
work anymore in newer versions, see #1540.
Therefore remove it and instead create a descriptive exception when making a
member accessible fails. If necessary users can also still use `java` command
line flags to open external modules.

* Fix failing to serialize Collection or Map with inaccessible constructor

Also remove tests which rely on Java implementation details.

* Don't keep reference to access exception of ConstructorConstructor

This also avoids a confusing stack trace, since the previously caught
exception might have had a complete unrelated stack trace.

* Remove Maven toolchain requirement

* Address review feedback

* Add back test for Security Manager
2021-11-09 07:16:35 -08:00
Inderjeet Singh 4081dbaa6d Added a test for serialization/deserialization of enum classes with
fields
2018-03-17 16:00:46 -07: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
Inderjeet Singh edd6c19670 deleted unused enum and reordered imports 2013-04-04 21:40:05 +00:00
Inderjeet Singh 7d53113ebc fixed https://code.google.com/p/google-gson/issues/detail?id=509 by adding construction for EnumSet 2013-04-04 21:15:50 +00:00
Jesse Wilson 214234e202 Support @SerializedName on annotations.
Fixes issue 347.
2011-12-16 05:32:50 +00:00
Inderjeet Singh fd502f4e79 removed unused method. 2011-09-16 05:41:04 +00:00
Inderjeet Singh c71e61cf48 Converted EnumTypeAdapter to new style.
Got rid of default Hierarchy Serializer/Deserializers from DefaultTypeAdapters.
Got rid of methods for gettting default serializers/deserializers/instance creators. Instead we reuse the static final instances.
Fixed warnings in TypeAdapters where a parameterized type T was hiding the parameterized T in methods.
Removed support to unwrap single element array of enums into enum values. Also removed the test that verifies this behavior.
2011-09-16 05:40:05 +00:00
Joel Leitch 21ddfc9b12 Show default serialization and deserialization works with subclasses of an enum type. 2011-04-04 19:19:46 +00:00
Inderjeet Singh 2b9f81e8b5 Registering default type hierarchy adapters first and allow users to override them.
This allows the default EnumTypeAdapter to be overridden for a specific hierachy adapter for Enum with anonymized sub-classes.
2011-01-19 23:28:28 +00:00
Inderjeet Singh d87eed510b Fixed compilation problem since we dropped registerTypeHierarchyAdapter method 2010-11-24 23:14:30 +00:00
Joel Leitch 6a951b427e Adding new tests (two of which are disabled, but prepping for 1.7). 2010-11-05 22:57:44 +00:00
Inderjeet Singh 2b1f3eec15 Removed a bunch of unused code and unnecessary else statements. 2010-09-28 13:42:43 +00:00
Jesse Wilson d5741b321f Don't exclude enum constants, even if they are anonymous.
See issue 226.
2010-08-27 07:26:35 +00:00
Inderjeet Singh e340801d25 Moved enum-related tests under EnumTest class. 2009-03-30 18:36:55 +00:00
Joel Leitch d34fb916cb Added tests for enum serialization and derserialization. 2009-01-20 00:52:54 +00:00