@Test
public void testRemove() throws Exception {

  Provider<EntityManager> entityManagerProvider =  createNiceMock(Provider.class);
  EntityManager entityManager = createNiceMock(EntityManager.class);
  HostDAO hostDAO = createNiceMock(HostDAO.class);
  HostEntity hostEntity = createNiceMock(HostEntity.class);
  HostComponentDesiredStateEntity hostComponentDesiredStateEntity = createNiceMock(HostComponentDesiredStateEntity.class);
  expect(entityManagerProvider.get()).andReturn(entityManager).anyTimes();
  entityManager.remove(hostComponentDesiredStateEntity);
  hostEntity.removeHostComponentDesiredStateEntity(hostComponentDesiredStateEntity);
  expect(hostDAO.merge(hostEntity)).andReturn(hostEntity).atLeastOnce();
  expect(hostComponentDesiredStateEntity.getHostEntity()).andReturn(hostEntity).atLeastOnce();
  replay(entityManagerProvider, entityManager, hostDAO, hostEntity, hostComponentDesiredStateEntity);
  HostComponentDesiredStateDAO dao = new HostComponentDesiredStateDAO();
  dao.entityManagerProvider = entityManagerProvider;
  dao.hostDAO = hostDAO;
  dao.remove(hostComponentDesiredStateEntity);
  verify(entityManagerProvider, entityManager, hostDAO, hostEntity, hostComponentDesiredStateEntity);
}