@Test public void testRemoveData() throws Exception { ViewInstanceDataEntity entity = new ViewInstanceDataEntity(); ViewInstanceDataEntity entity2 = new ViewInstanceDataEntity(); expect(entityManager.merge(eq(entity))).andReturn(entity2); entityManager.remove(eq(entity2)); replay(entityManager); ViewInstanceDAO dao = new ViewInstanceDAO(); dao.entityManagerProvider = entityManagerProvider; dao.removeData(entity); verify(entityManagerProvider, entityManager); }
@Transactional public void removeData(ViewInstanceDataEntity viewInstanceDataEntity) { entityManagerProvider.get().remove(mergeData(viewInstanceDataEntity)); }
ViewInstanceDAO { @Transactional public void removeData(ViewInstanceDataEntity viewInstanceDataEntity) { entityManagerProvider.get().remove(mergeData(viewInstanceDataEntity)); } }
ViewInstanceDAO { @Transactional public void removeData(ViewInstanceDataEntity viewInstanceDataEntity) { entityManagerProvider.get().remove(mergeData(viewInstanceDataEntity)); }  }
ViewInstanceDAO { @Transactional public void removeData(ViewInstanceDataEntity viewInstanceDataEntity) { entityManagerProvider.get().remove(mergeData(viewInstanceDataEntity)); }  @RequiresSession ViewInstanceEntity findByName(String viewName, String instanceName); @RequiresSession ViewInstanceEntity findByResourceId(long resourceId); @RequiresSession List<ViewInstanceEntity> findAll(); @RequiresSession ResourceEntity findResourceForViewInstance(String viewName,
      String instanceName); @Transactional void refresh(ViewInstanceEntity viewInstanceEntity); @Transactional void create(ViewInstanceEntity viewInstanceEntity); @Transactional ViewInstanceEntity merge(ViewInstanceEntity viewInstanceEntity); @Transactional void remove(ViewInstanceEntity viewInstanceEntity); @Transactional ViewInstanceDataEntity mergeData(ViewInstanceDataEntity viewInstanceDataEntity); @Transactional void removeData(ViewInstanceDataEntity viewInstanceDataEntity); }
ViewInstanceDAO { @Transactional public void removeData(ViewInstanceDataEntity viewInstanceDataEntity) { entityManagerProvider.get().remove(mergeData(viewInstanceDataEntity)); }  @RequiresSession ViewInstanceEntity findByName(String viewName, String instanceName); @RequiresSession ViewInstanceEntity findByResourceId(long resourceId); @RequiresSession List<ViewInstanceEntity> findAll(); @RequiresSession ResourceEntity findResourceForViewInstance(String viewName,
      String instanceName); @Transactional void refresh(ViewInstanceEntity viewInstanceEntity); @Transactional void create(ViewInstanceEntity viewInstanceEntity); @Transactional ViewInstanceEntity merge(ViewInstanceEntity viewInstanceEntity); @Transactional void remove(ViewInstanceEntity viewInstanceEntity); @Transactional ViewInstanceDataEntity mergeData(ViewInstanceDataEntity viewInstanceDataEntity); @Transactional void removeData(ViewInstanceDataEntity viewInstanceDataEntity);  }