### Question:
AMETICDummyAdapter extends BasicAuthServiceAdapter implements ExternalServiceAdapter { @Override public ServiceResponse[] getRaw(String attribute) throws AttributeNotSupportedException, ServiceNotAvailableException, ServiceException { if (!this.isConnected()) { throw new ServiceNotAvailableException(); } AttributeMap attributeMap = new AttributeMap(); String genericAttribute = attributeMap.getAttribute(attribute); Map<String, String> ids = attributeMap.extractIds(genericAttribute, attribute); if (genericAttribute.equals(AttributeMap.EVENT_ATTENDEES)) { String url = "/ameticevents/" + ids.get(AttributeMap.EVENT_ID) + "/@all"; ServiceResponse[] r = new ServiceResponse[1]; r[0] = new ServiceResponse(ServiceResponse.XML, attribute, url, this.proxy.get(url)); return r; } else if (genericAttribute.equals(AttributeMap.EVENT_DETAILS)) { String url = "/ameticevents/" + ids.get(AttributeMap.EVENT_ID) + "/info"; ServiceResponse[] r = new ServiceResponse[1]; r[0] = new ServiceResponse(ServiceResponse.XML, attribute, url, this.proxy.get(url)); return r; } else if (genericAttribute.equals(AttributeMap.EVENT_ALL)) { String url = "/ameticevents/@all"; ServiceResponse[] r = new ServiceResponse[1]; r[0] = new ServiceResponse(ServiceResponse.XML, attribute, url, this.proxy.get(url)); return r; } throw new AttributeNotSupportedException(attribute, this); } AMETICDummyAdapter(); String getAdapterName(); @Override void _set(String attribute, Object value); @Override void _delete(String attribute); @Override ServiceResponse[] getRaw(String attribute); @Override Boolean isConnected(); final static String adapterName; }### Answer:
@Test public void testGetRaw() throws Exception { AMETICDummyAdapter adapter = createAdapter(); ServiceResponse[] attendees = adapter.getRaw("/event/@me/173/@all"); assertTrue (attendees[0].getResponse().length() > 0); ServiceResponse[] eventDetails = adapter.getRaw("/event/@me/173"); assertTrue (eventDetails[0].getResponse().length() > 0); ServiceResponse[] allEvents = adapter.getRaw("/event/@all"); assertTrue (allEvents[0].getResponse().length() > 0); }
@Test public void testRegister() throws Exception { AMETICDummyAdapter adapter = createAdapter(); adapter.register("ameticadmin", "ameticpass"); ServiceResponse[] attendees = adapter.getRaw("/event/@me/173/@all"); assertTrue (attendees[0].getResponse().length() > 0); }