DefaultComputationTargetResolver implements ComputationTargetResolver, LazyResolver, ComputationTargetTypeProvider { @Override public ComputationTarget resolve(final ComputationTargetSpecification specification, final VersionCorrection versionCorrection) { final ComputationTargetType type = specification.getType(); if (ComputationTargetType.NULL == type) { return ComputationTarget.NULL; } else { final ObjectResolver<?> resolver = _resolvers.get(type); if (resolver != null) { final UniqueIdentifiable resolved = resolver.resolveObject(specification.getUniqueId(), versionCorrection); if (resolved != null) { return ComputationTargetResolverUtils.createResolvedTarget(specification, resolved); } else { s_logger.info("Unable to resolve {}", specification); return null; } } else { throw new OpenGammaRuntimeException("Unhandled computation target type " + specification.getType()); } } } DefaultComputationTargetResolver();  DefaultComputationTargetResolver(final SecuritySource securitySource);  DefaultComputationTargetResolver(final SecuritySource securitySource, final PositionSource positionSource); void addResolver(final ComputationTargetType type, final ObjectResolver<T> resolver); void addResolver(final PrimitiveComputationTargetType<?> type); @Override void setLazyResolveContext(final LazyResolveContext context); @Override LazyResolveContext getLazyResolveContext(); @Override SecuritySource getSecuritySource(); @Override ComputationTarget resolve(final ComputationTargetSpecification specification, final VersionCorrection versionCorrection); @Override ObjectResolver<?> getResolver(final ComputationTargetSpecification specification); @Override ComputationTargetType simplifyType(final ComputationTargetType type); @Override ComputationTargetSpecificationResolver getSpecificationResolver(); @Override ComputationTargetResolver.AtVersionCorrection atVersionCorrection(final VersionCorrection versionCorrection); @Override ChangeManager changeManager(); @Override String toString(); @Override Collection<ComputationTargetType> getSimpleTypes(); @Override Collection<ComputationTargetType> getAdditionalTypes(); @Override Collection<ComputationTargetType> getAllTypes();  }
@Test(expectedExceptions = NullPointerException.class) public void test_resolve_nullSpecification() { final InMemorySecuritySource secSource = new InMemorySecuritySource(); final MockPositionSource posSource = new MockPositionSource(); final DefaultComputationTargetResolver test = new DefaultComputationTargetResolver(secSource, posSource); test.resolve(null, VersionCorrection.LATEST); }