@Test
public void copyAllObjects() throws Exception {

  ViewEntity entity1 = getViewEntityMock(VERSION_1);
  ViewEntity entity2 = getViewEntityMock(VERSION_2);
  replay(entity1, entity2);
  ViewInstanceEntity instanceEntity1 = getViewInstanceEntityMock(entity1);
  ViewInstanceEntity instanceEntity2 = getViewInstanceEntityMock(entity2);
  replay(instanceEntity1, instanceEntity2);
  TestViewDataMigrationContextImpl context = new TestViewDataMigrationContextImpl(instanceEntity1, instanceEntity2);
  DataStore dataStore1 = createStrictMock(DataStore.class);
  expect(dataStore1.findAll(eq(SampleEntity.class), (String) isNull())).andReturn(
      Arrays.asList(new SampleEntity("data1"), new SampleEntity("data2")));
  replay(dataStore1);
  DataStore dataStore2 = createStrictMock(DataStore.class);
  Capture<SampleEntity> copiedEntity1 = Capture.newInstance();
  Capture<SampleEntity> copiedEntity2 = Capture.newInstance();
  dataStore2.store(capture(copiedEntity1)); expectLastCall();
  dataStore2.store(capture(copiedEntity2)); expectLastCall();
  replay(dataStore2);
  context.setMockOriginDataStore(dataStore1);
  context.setMockCurrentDataStore(dataStore2);
  context.copyAllObjects(SampleEntity.class, SampleEntity.class);
  verify(dataStore1);
  verify(dataStore2);
  Assert.assertEquals("data1", copiedEntity1.getValue().getField());
  Assert.assertEquals("data2", copiedEntity2.getValue().getField());
}