  @SuppressWarnings("unchecked")
  @Test
  public void testSerializeUnrestrictedSubTypeFields() {

    Gson gson = new GsonBuilder()
      .registerTypeAdapterFactory(new RestrictSerializationToBaseClassFactory<Base>(Base.class, Sub1.class))
      .create();
    String json = gson.toJson(new Container());
    assertTrue(json.contains("\"a\":1"));
    assertFalse(json.contains("\"b\""));
    assertTrue(json.contains("\"c\":3"));
  }