assertEquals(trade.getQuantity(), underlying.getQuantity());
assertEquals(trade.getSecurity().getUniqueId(), underlying.getSecurity().getUniqueId());
}
public void testSerialization_targetResolver() throws Exception {
final MockComputationTargetResolver resolver = MockComputationTargetResolver.resolved();
final Trade underlying = resolver.getPositionSource().getTrade(UniqueId.of("Trade", "0"));
underlying.setAttributes(ImmutableMap.of("K1", "V1"));
Trade trade = new LazyResolvedTrade(new LazyResolveContext(resolver.getSecuritySource(), new DefaultCachingComputationTargetResolver(resolver,
_cacheManager)).atVersionCorrection(VersionCorrection.LATEST), underlying);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
new ObjectOutputStream(baos).writeObject(trade);
final Object result = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())).readObject();
assertTrue(result instanceof TargetResolverTrade);