@Test
public void testInitialization() {

	Replicator replicator;
	MockReplicationSource source;
	MockReplicationDestination destination;
	MockTransactionSnapshotLoader snapshotLoader;
	MockSystemTimeLoader timeLoader;
	ReplicationState state;
	
	// Build the mocks.
	source = new MockReplicationSource();
	destination = new MockReplicationDestination();
	snapshotLoader = new MockTransactionSnapshotLoader();
	timeLoader = new MockSystemTimeLoader();
	
	// Instantiate the new replicator.
	replicator = new Replicator(source, destination, snapshotLoader, timeLoader, 1, 0, 0);
	
	// Provide initialisation data.
	timeLoader.getTimes().add(buildDate("2009-10-11 12:13:14"));
	timeLoader.getTimes().add(buildDate("2009-10-11 12:13:14"));
	snapshotLoader.getSnapshots().add(new TransactionSnapshot("100:200:110,112"));
	
	// Launch the replication process.
	replicator.replicate();
	
	// Verify the final state.
	state = destination.getCurrentState();
	Assert.assertEquals("Incorrect final state.",
			new ReplicationState(
					200,
					200,
					Arrays.asList(new Long[]{110L, 112L}),
					Arrays.asList(new Long[]{}),
					buildDate("2009-10-11 12:13:14"),
					0),
			state);
}