assertEquals(node.getPositions().size(), underlying.getPositions().size());
}
public void testSerialization_targetResolver() throws Exception {
final MockComputationTargetResolver resolver = MockComputationTargetResolver.resolved();
final PortfolioNode underlying = resolver.getPositionSource().getPortfolioNode(UniqueId.of("Node", "0"), VersionCorrection.LATEST);
PortfolioNode node = new LazyResolvedPortfolioNode(new LazyResolveContext(resolver.getSecuritySource(), new DefaultCachingComputationTargetResolver(resolver,
_cacheManager)).atVersionCorrection(VersionCorrection.LATEST), underlying);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
new ObjectOutputStream(baos).writeObject(node);
final Object resultObject = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())).readObject();
assertTrue(resultObject instanceof TargetResolverPortfolioNode);
node = (PortfolioNode) resultObject;
assertEquals(node.getName(), underlying.getName());
assertEquals(node.getChildNodes().size(), underlying.getChildNodes().size());
assertEquals(node.getPositions().size(), underlying.getPositions().size());
}