InMemoryInterpolatedYieldCurveDefinitionMaster implements InterpolatedYieldCurveDefinitionMaster, InterpolatedYieldCurveDefinitionSource, ChangeProvider { @Override public synchronized YieldCurveDefinition getDefinition(Currency currency, String name) { return getDefinition(currency, name, VersionCorrection.LATEST); } InMemoryInterpolatedYieldCurveDefinitionMaster(); String getUniqueIdScheme(); void setUniqueIdScheme(final String scheme); @Override synchronized YieldCurveDefinition getDefinition(Currency currency, String name); @Override YieldCurveDefinition getDefinition(final Currency currency, final String name, final VersionCorrection versionCorrection); @Override synchronized YieldCurveDefinitionDocument add(YieldCurveDefinitionDocument document); @Override synchronized YieldCurveDefinitionDocument addOrUpdate(YieldCurveDefinitionDocument document); @Override YieldCurveDefinitionDocument correct(YieldCurveDefinitionDocument document); @Override synchronized YieldCurveDefinitionDocument get(UniqueId uid); @Override synchronized YieldCurveDefinitionDocument get(ObjectIdentifiable objectIdable, VersionCorrection versionCorrection); @Override synchronized void remove(ObjectIdentifiable objectIdentifiable); @Override synchronized YieldCurveDefinitionDocument update(YieldCurveDefinitionDocument document); @Override ChangeManager changeManager(); @Override List<UniqueId> replaceVersions(ObjectIdentifiable objectIdentifiable, List<YieldCurveDefinitionDocument> replacementDocuments); @Override List<UniqueId> replaceAllVersions(ObjectIdentifiable objectIdentifiable, List<YieldCurveDefinitionDocument> replacementDocuments); @Override List<UniqueId> replaceVersion(UniqueId uniqueId, List<YieldCurveDefinitionDocument> replacementDocuments); @Override void removeVersion(final UniqueId uniqueId); @Override UniqueId replaceVersion(YieldCurveDefinitionDocument replacementDocument); @Override UniqueId addVersion(ObjectIdentifiable objectId, YieldCurveDefinitionDocument documentToAdd); @Override Map<UniqueId, YieldCurveDefinitionDocument> get(Collection<UniqueId> uniqueIds); static final String DEFAULT_SCHEME; }
@Test public void testGetDefinition() { YieldCurveDefinition yc = _master.getDefinition(Currency.USD, "1"); assertNotNull(yc); assertEquals("A", yc.getInterpolatorName()); assertEquals("L1", yc.getLeftExtrapolatorName()); assertEquals("R1", yc.getRightExtrapolatorName()); assertTrue(yc.isInterpolateYields()); yc = _master.getDefinition(Currency.GBP, "1"); assertNotNull(yc); assertEquals("B", yc.getInterpolatorName()); assertEquals("L2", yc.getLeftExtrapolatorName()); assertEquals("R2", yc.getRightExtrapolatorName()); assertFalse(yc.isInterpolateYields()); yc = _master.getDefinition(Currency.USD, "2"); assertNotNull(yc); assertEquals("C", yc.getInterpolatorName()); assertEquals("L3", yc.getLeftExtrapolatorName()); assertEquals("R3", yc.getRightExtrapolatorName()); assertFalse(yc.isInterpolateYields()); yc = _master.getDefinition(Currency.GBP, "2"); assertNotNull(yc); assertEquals("D", yc.getInterpolatorName()); assertEquals("L4", yc.getLeftExtrapolatorName()); assertEquals("R4", yc.getRightExtrapolatorName()); assertTrue(yc.isInterpolateYields()); }
@Test public void testGetDefinition_missing() { assertNull(_master.getDefinition(Currency.USD, "3")); assertNull(_master.getDefinition(Currency.CHF, "1")); }
@Test public void testGetDefinition_instant() { assertNotNull(_master.getDefinition(Currency.USD, "1", VersionCorrection.ofVersionAsOf(Instant.now()))); }