SourceLinkResolver implements LinkResolver<I, T> { @Override public T resolve(LinkIdentifier<I, T> identifier) { VersionCorrectionProvider vcProvider = lookupService(VersionCorrectionProvider.class); S source = lookupService(getSourceClass()); return executeQuery(source, identifier.getType(), identifier.getIdentifier(), getVersionCorrection(vcProvider)); } SourceLinkResolver(ServiceContext serviceContext);   SourceLinkResolver(); @Override T resolve(LinkIdentifier<I, T> identifier);  }
@Test(expectedExceptions = IllegalStateException.class) public void noThreadLocalContextGivesError() { SourceLinkResolver<String, Object, ConfigSource> resolver = createSourceLinkResolver(); resolver.resolve(createIdentifier("id")); }
@Test(expectedExceptions = IllegalArgumentException.class) public void noVersionCorrectionGivesError() { ServiceContext serviceContext = createContext(ConfigSource.class); SourceLinkResolver<String, Object, ConfigSource> resolver = createSourceLinkResolver(serviceContext); resolver.resolve(createIdentifier("id")); }
@Test(expectedExceptions = IllegalArgumentException.class) public void noSourceGivesError() { ServiceContext serviceContext = createContext(VersionCorrectionProvider.class); SourceLinkResolver<String, Object, ConfigSource> resolver = createSourceLinkResolver(serviceContext); resolver.resolve(createIdentifier("id")); }