Resource { public SortedMap<String, String> getMap() { if (content == null) { init(); } return map; } Resource(String path, Resource origin); String getPath(); Resource getOrigin(); boolean isXml(); String getContent(); SortedMap<String, String> getMap(); @Override String toString(); static String readText(Reader reader);  }
@Test public void testGetMapXML() throws Exception { TestResource testResource = new TestResource("path/", "<?xml>this is XML</xml>", null); SortedMap<String, String> map = testResource.getMap(); assertNotNull(map); assertTrue(map.isEmpty()); }
@Test public void testGetMapProperties() throws Exception { TestResource testResource = new TestResource("path", "key = value\nkey2=anothervalue\n", null); SortedMap<String, String> map = testResource.getMap(); assertNotNull(map); assertEquals(2, map.size()); assertEquals("value", map.get("key")); assertEquals("anothervalue", map.get("key2")); }