@Test
public void testExecutePreDMLUpdates() throws Exception {

  Module module = new Module() {
    @Override
    public void configure(Binder binder) {
      binder.bind(DBAccessor.class).toInstance(dbAccessor);
      binder.bind(OsFamily.class).toInstance(osFamily);
      binder.bind(EntityManager.class).toInstance(entityManager);
      binder.bind(Configuration.class).toInstance(configuration);
    }
  };
  EntityManagerFactory emFactory = EasyMock.createNiceMock(EntityManagerFactory.class);
  Cache emCache = EasyMock.createNiceMock(Cache.class);
  expect(entityManager.getEntityManagerFactory()).andReturn(emFactory).atLeastOnce();
  expect(emFactory.getCache()).andReturn(emCache).atLeastOnce();
  EntityTransaction mockTransaction = EasyMock.createNiceMock(EntityTransaction.class);
  Connection mockConnection = EasyMock.createNiceMock(Connection.class);
  Statement mockStatement = EasyMock.createNiceMock(Statement.class);
  expect(dbAccessor.getConnection()).andReturn(mockConnection).once();
  expect(mockConnection.createStatement()).andReturn(mockStatement).once();
  expect(mockStatement.executeQuery(EasyMock.anyString())).andReturn(
      EasyMock.createNiceMock(ResultSet.class));
  expect(entityManager.getTransaction()).andReturn(
      mockTransaction).atLeastOnce();
  dbAccessor.dropTable(UpgradeCatalog300.CLUSTER_CONFIG_MAPPING_TABLE);
  EasyMock.expectLastCall().once();
  replay(dbAccessor, entityManager, emFactory, emCache, mockConnection, mockTransaction,
      mockStatement, configuration);
  Injector injector = Guice.createInjector(module);
  UpgradeCatalog300 upgradeCatalog300 = injector.getInstance(UpgradeCatalog300.class);
  upgradeCatalog300.executePreDMLUpdates();
  verify(dbAccessor, entityManager, emFactory, emCache);
}