Resources { public Resources merge(Resources resources) { members.putAll(resources.members); return this; } Resources();  Resources(@NonNull ConcurrentHashMap<String, Resource> members); static Resources from(Reader reader, Converter converter); static Resources from(String string, Converter converter); static Resources fromJson(Reader reader); static Resources fromJson(String string); static Resources fromJson(InputStream reader); static Resources fromXml(Reader reader); static Resources fromXml(String string); static Resources fromXml(InputStream reader); Resource add(String key, Resource value); boolean has(String key); Resource get(String key); Resources merge(Resources resources);  }
@Test public void testMerge() throws Exception { Resources firstResources = new Resources(EMPTY_HASH_MAP); firstResources.add("foo", new Resource("bar")); firstResources.add("month", new Resource("june")); Resources lastResources = new Resources(EMPTY_HASH_MAP); lastResources.add("hello", new Resource("world")); lastResources.add("month", new Resource("may")); firstResources.merge(lastResources); assertEquals(firstResources.members.size(), 3); assertTrue(firstResources.has("foo")); assertTrue(firstResources.has("hello")); assertTrue(firstResources.has("month")); assertEquals(firstResources.get("month").getAsString(), "may"); }