BlueprintDAO { @Transactional public void removeByName(String blueprint_name) { entityManagerProvider.get().remove(findByName(blueprint_name)); }  @RequiresSession BlueprintEntity findByName(String blueprint_name); @RequiresSession List<BlueprintEntity> findAll(); @Transactional void refresh(BlueprintEntity blueprintEntity); @Transactional void create(BlueprintEntity blueprintEntity); @Transactional BlueprintEntity merge(BlueprintEntity blueprintEntity); @Transactional void remove(BlueprintEntity blueprintEntity); @Transactional void removeByName(String blueprint_name);  }
@Test public void testRemoveByName() { BlueprintEntity entity = new BlueprintEntity(); BlueprintDAO dao = new BlueprintDAO(); dao.entityManagerProvider = entityManagerProvider; expect(entityManager.find(eq(BlueprintEntity.class), eq("test"))).andReturn(entity); entityManager.remove(entity); expectLastCall(); replay(entityManager); dao.removeByName("test"); verify(entityManager); }