JsonConverter implements Converter { @Override @Nullable public Resources fromReader(Reader reader) throws IOException { JsonObject jsonObject = GSON.fromJson(reader, JsonObject.class); if (null == jsonObject) { return null; } Resources resources = new Resources(); for (Map.Entry<String, JsonElement> entry : jsonObject.entrySet()) { Resource resource = GSON.fromJson(entry.getValue(), Resource.class); if (null != resource) { resources.add(entry.getKey(), resource); } } return resources; }  @Override @Nullable Resources fromReader(Reader reader); @SuppressWarnings("unused") Resources fromString(String string);  }
@SuppressWarnings("ConstantConditions") @Test public void testFromReader() throws Exception { Resources resources = new JsonConverter().fromReader(resourcesSteamReader); assertTrue("hello key exists", resources.has("hello")); assertTrue("screen_small key exists", resources.has("screen_small")); assertTrue("adjust_view_bounds key exists", resources.has("adjust_view_bounds")); assertTrue("max_speed key exists", resources.has("max_speed")); assertTrue("min_speed key exists", resources.has("min_speed")); assertTrue("planets_array key exists", resources.has("planets_array")); assertTrue("planets_array is array", resources.get("planets_array").isArray()); assertTrue("bits key exists", resources.has("bits")); assertTrue("bits is array", resources.get("bits").isArray()); }