### Question:
SystemPropertyDAO extends DefaultDAOBase<Integer, SystemProperty> { public List<SystemProperty> findByComponent(String component) { Criteria criteria = createCriteria(equalsComponent(component)); criteria.addOrder(Order.asc(SystemProperty.NAME_PROPERTY)); return getResultList(criteria); } SystemPropertyDAO();  SystemPropertyDAO(EntityManager entityManager); boolean existsAnyWithName(String name); boolean existsAnyOtherWithName(SystemProperty systemProperty, String name); SystemProperty findByName(String name); List<SystemProperty> findByComponent(String component);  }### Answer:
@Test public void test_findByComponent() { SystemProperty server1 = createUniqueEntity(); SystemProperty server2 = createUniqueEntity(); SystemProperty server3 = createUniqueEntity(); SystemProperty vsm = createUniqueEntity(); SystemProperty noComponent = createUniqueEntity(); server1.setName("server.prop1"); server2.setName("server.prop2"); server3.setName("server.prop3"); vsm.setName("vsm.prop1"); noComponent.setName("serverNoComponent"); ds().persistAll(server1, server2, server3, vsm); SystemPropertyDAO dao = createDaoForRollbackTransaction(); List<SystemProperty> serverProps = dao.findByComponent("server"); List<SystemProperty> vsmProps = dao.findByComponent("vsm"); List<SystemProperty> clientProps = dao.findByComponent("client"); assertSize(serverProps, 3); assertSize(vsmProps, 1); assertSize(clientProps, 0); }