### Question:
AttributeMap { public String getAttribute (String input) { Iterator<String> iterator = this.attributes.iterator(); while (iterator.hasNext()) { String candidate = iterator.next(); String attr = candidate.replaceAll("\\{\\w+\\}", "([^/]+)"); if (input.matches(attr)) { return candidate; } } return null; } AttributeMap(); String getAttribute(String input); Map<String, String> extractIds(String attribute, String input); static final String EVENT_ID; static final String USER_ID; static final String EVENT_ALL; static final String EVENT_ALLMINE; static final String EVENT_DETAILS; static final String EVENT_ATTENDEES; static final String EVENT_ATTENDEEDETAILS; static final String PROFILE_ME; static final String PROFILE_MYDETAILS; static final String PROFILE_DETAILS; static final String PROFILEATTRIBUTE_MYDETAILS; static final String PROFILEATTRIBUTE_DETAILS; static final String FRIEND_ALL; static final String FRIEND_DETAILS; static final String GROUP_ALL; static final String LIVEPOST_ALL; static final String LIVEPOST_ALLMINE; static final String LIVEPOST_ALLUSER; static final String NOTIFICATION; static final String PLACE_ALL; static final String ACTIVITY_ALL; static final String ACTIVITY_DETAILS; }### Answer:
@Test public void testGetAttribute() { AttributeMap attributeMap = new AttributeMap(); assertTrue("Wrong mapping found for getAttribute(/event/@all).", attributeMap.getAttribute("/event/@all").equals(AttributeMap.EVENT_ALL)); assertTrue("Wrong mapping found for getAttribute(/event/@me/123).", attributeMap.getAttribute("/event/@me/123").equals(AttributeMap.EVENT_DETAILS)); }