@Test public void loadingOldParseTest() throws IOException { Experience experience = TestUtils.loadExperience("test_old"); Assert.assertTrue(experience.getName().equals("Test")); final Gson gson = ExperienceParser.createGson(null); System.out.println(gson.toJson(experience)); }
public static Gson createGson(Context context) { if (gson == null) { GsonBuilder builder = new GsonBuilder(); if (context == null || Feature.get(context, R.bool.feature_load_old_experiences).isEnabled()) { builder.registerTypeAdapterFactory(new ExperienceTypeAdapterFactor()); } gson = builder.create(); } return gson; }
ExperienceParser { public static Gson createGson(Context context) { if (gson == null) { GsonBuilder builder = new GsonBuilder(); if (context == null || Feature.get(context, R.bool.feature_load_old_experiences).isEnabled()) { builder.registerTypeAdapterFactory(new ExperienceTypeAdapterFactor()); } gson = builder.create(); } return gson; } }
ExperienceParser { public static Gson createGson(Context context) { if (gson == null) { GsonBuilder builder = new GsonBuilder(); if (context == null || Feature.get(context, R.bool.feature_load_old_experiences).isEnabled()) { builder.registerTypeAdapterFactory(new ExperienceTypeAdapterFactor()); } gson = builder.create(); } return gson; }  }
ExperienceParser { public static Gson createGson(Context context) { if (gson == null) { GsonBuilder builder = new GsonBuilder(); if (context == null || Feature.get(context, R.bool.feature_load_old_experiences).isEnabled()) { builder.registerTypeAdapterFactory(new ExperienceTypeAdapterFactor()); } gson = builder.create(); } return gson; }  static Gson createGson(Context context); }
ExperienceParser { public static Gson createGson(Context context) { if (gson == null) { GsonBuilder builder = new GsonBuilder(); if (context == null || Feature.get(context, R.bool.feature_load_old_experiences).isEnabled()) { builder.registerTypeAdapterFactory(new ExperienceTypeAdapterFactor()); } gson = builder.create(); } return gson; }  static Gson createGson(Context context);  }