SearchDocument { String getProperty(String key) { if (key == null) { return ""; } if (!key.contains(" ")) { Object value = document.get(key); if (value instanceof String) { return (String) value; } else { return ""; } } else { StringBuilder builder = new StringBuilder(""); String[] parts = key.split(" "); for (String part : parts) { builder.append(getProperty(part)).append(' '); } return builder.toString(); } } SearchDocument(Map<String, Object> document);   }
@Test public void testGetProperty() throws Exception { assertEquals("testvalue", parser.getProperty("testkey")); }