BlueprintDAO { @RequiresSession public BlueprintEntity findByName(String blueprint_name) { return entityManagerProvider.get().find(BlueprintEntity.class, 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 testFindByName() { BlueprintEntity entity = new BlueprintEntity(); expect(entityManager.find(eq(BlueprintEntity.class), eq("test-cluster-name"))).andReturn(entity); replay(entityManager); BlueprintDAO dao = new BlueprintDAO(); dao.entityManagerProvider = entityManagerProvider; BlueprintEntity result = dao.findByName("test-cluster-name"); assertSame(result, entity); verify(entityManagerProvider, entityManager); }