### Question:
DestinationRegistryImpl implements DestinationRegistry, ServletConfigAware { public AbstractHTTPDestination checkRestfulRequest(String address) { AbstractHTTPDestination ret = getRestfulDestination(getDestinationsPaths(), address); if (ret == null) { ret = getRestfulDestination(decodedDestinations.keySet(), address); } if (ret != null && ret.getMessageObserver() == null) { return null; } return ret; } DestinationRegistryImpl(); synchronized void addDestination(AbstractHTTPDestination destination); synchronized void removeDestination(String path); AbstractHTTPDestination getDestinationForPath(String path); AbstractHTTPDestination getDestinationForPath(String path, boolean tryDecoding); AbstractHTTPDestination checkRestfulRequest(String address); Collection<AbstractHTTPDestination> getDestinations(); AbstractDestination[] getSortedDestinations(); Set<String> getDestinationsPaths(); String getTrimmedPath(String path); @Override void onServletConfigAvailable(ServletConfig config);  }### Answer:
@Test public void testCheckRestfulRequest() throws Exception { setUpDestinations(); for (int i = 0; i < REQUEST_PATHS.length; i++) { final int mi = MATCHED_PATH_INDEXES[i]; for (int j = 0; j < REGISTERED_PATHS.length; j++) { AbstractHTTPDestination target = registry.getDestinationForPath(REGISTERED_PATHS[j]); if (mi == j) { EasyMock.expect(target.getMessageObserver()).andReturn(observer); EndpointInfo endpoint = new EndpointInfo(); endpoint.setAddress(REGISTERED_PATHS[mi]); endpoint.setName(QNAME); EasyMock.expect(target.getEndpointInfo()).andReturn(endpoint); } else { EasyMock.expect(target.getMessageObserver()).andReturn(observer).anyTimes(); } } control.replay(); AbstractHTTPDestination destination = registry.checkRestfulRequest(REQUEST_PATHS[i]); if (0 <= mi) { EndpointInfo endpoint = destination.getEndpointInfo(); assertNotNull(endpoint); assertEquals(endpoint.getAddress(), REGISTERED_PATHS[mi]); } else { assertNull(destination); } control.verify(); control.reset(); } }