gkopff / gson-javatime-serialisers

A set of GSON serialiser/deserialisers for dealing with Java 8 java.time entities.
MIT License
87 stars 19 forks source link

Tests are too weak #10

Closed mwanji closed 9 years ago

mwanji commented 9 years ago

I can change Converters#registerAll(GsonBuilder) to the following, and all tests still pass:

public static GsonBuilder registerAll(GsonBuilder builder)
  {
    if (builder == null) { throw new NullPointerException("builder cannot be null"); }

//    registerLocalDate(builder);
//    registerLocalDateTime(builder);
//    registerLocalTime(builder);
//    registerOffsetDateTime(builder);
//    registerOffsetTime(builder);
    registerZonedDateTime(builder);

    return builder;
  }

ConvertersTest should probably convert Container to a JsonTree and compare values against what is returned using the converters directly. In my example, LocalDate becomes {"year":2014,"month":12,"day":11}, which is deserialised without a problem.

UPDATE:

Just saw that this is the case for ALL tests. I can comment out the type adapter registration and the test still passes. So essentially nothing is being tested.