final TestProxyAdapter movieAdapter = new TestProxyAdapter();
movieAdapter.setupResolveState(ResolveState.RESOLVED);
mockery.checking(new Expectations() {
{
final DummyObjectData movieData = encoderShouldCreateGraphForChangedMovie(movieAdapter);
final DummyObjectData directorData = encoderShouldCreateGraphForChangedDirector(directorAdapter);
distributionShouldExecuteClientActionForBothChangedObjects(movieData, directorData);
}
private DummyObjectData encoderShouldCreateGraphForChangedMovie(final TestProxyAdapter movieAdapter) {
final DummyObjectData movieData =
new DummyObjectData(new TestProxyOid(12, true), Movie.class.getName(), true,
new TestProxyVersion(4));
final DummyEncodeableObjectData expectedMovieName =
new DummyEncodeableObjectData("War of the Worlds", String.class.getName());
final DummyReferenceData expectedDirectorRef =
new DummyReferenceData(new TestProxyOid(14, true), Person.class.getName(), new TestProxyVersion(8));
movieData.setFieldContent(new Data[] { expectedDirectorRef, expectedMovieName });
one(mockEncoder).encodeGraphForChangedObject(movieAdapter, new KnownObjectsRequest());
will(returnValue(movieData));
return movieData;
}
private DummyObjectData encoderShouldCreateGraphForChangedDirector(final TestProxyAdapter directorAdapter) {
final DummyObjectData directorData =
new DummyObjectData(new TestProxyOid(14, true), Person.class.getName(), true, new TestProxyVersion(
8));
final DummyEncodeableObjectData expectedDirectorName =
new DummyEncodeableObjectData("Unknown", String.class.getName());
directorData.setFieldContent(new Data[] { expectedDirectorName });
one(mockEncoder).encodeGraphForChangedObject(directorAdapter, new KnownObjectsRequest());
will(returnValue(directorData));
return directorData;
}