public void test() throws ResolverException {
ResolverStubImpl resolver = new ResolverStubImpl();
resolver.setRequestUrlPattern("http://nbn-resolving.de/$identifier");
ResolverRequest resolverRequest = new ResolverRequest();
resolverRequest.setIdentifier("urn:nbn:de:gbv:089-3321752945");
ResolverResponse response = resolver
.getResponse(resolverRequest);
assertEquals(
"http://edok01.tib.uni-hannover.de/edoks/e01dh01/332175294.pdf",
response.getUrl());
resolverRequest = new ResolverRequest();
resolverRequest.setIdentifier("invalidUri");
try {
response = resolver.getResponse(resolverRequest);
fail();
} catch (ResolverException e) {
assertEquals(ResolverExceptionCode.INVALID_IDENTIFIER, e
.getExceptionCode());
}
ResolverStubImpl doiResolver = new ResolverStubImpl();
doiResolver.setRequestUrlPattern("http://dx.doi.org/$identifier");
resolverRequest = new ResolverRequest();
resolverRequest.setIdentifier("doi:10.1000/182quatsch");
response = doiResolver
.getResponse(resolverRequest);
assertEquals(
"http://www.doi.org/hb.html",
response.getUrl());
}