@Test
public void resourceReferenceWithLessSegments()
{
PackageResourceReference resource = new PackageResourceReference(getClass(),
"crypt/crypt.txt");
Url url = mapper.mapHandler(new ResourceReferenceRequestHandler(resource));
url.getSegments().remove(url.getSegments().size() - 1);
url.getSegments().remove(url.getSegments().size() - 1);
url.getSegments().add("less-crypt.txt");
Request request = getRequest(url);
IRequestHandler requestHandler = mapper.mapRequest(request);
assertTrue(requestHandler instanceof RequestSettingRequestHandler);
requestHandler = ((RequestSettingRequestHandler)requestHandler).getDelegateHandler();
assertTrue(requestHandler instanceof ResourceReferenceRequestHandler);
ResourceReferenceRequestHandler handler = (ResourceReferenceRequestHandler)requestHandler;
assertEquals(getClass(), handler.getResourceReference().getScope());
assertEquals("less-crypt.txt", handler.getResourceReference().getName());
}