### Question:
ServiceConfigDAO { @RequiresSession public List<ServiceConfigEntity> getServiceConfigsForServiceAndStack(Long clusterId, StackId stackId, String serviceName) { StackEntity stackEntity = stackDAO.find(stackId.getStackName(), stackId.getStackVersion()); TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().createNamedQuery( "ServiceConfigEntity.findAllServiceConfigsByStack", ServiceConfigEntity.class); query.setParameter("clusterId", clusterId); query.setParameter("stack", stackEntity); query.setParameter("serviceName", serviceName); return daoUtils.selectList(query); }  @RequiresSession ServiceConfigEntity find(Long serviceConfigId); @RequiresSession ServiceConfigEntity findByServiceAndVersion(String serviceName, Long version); @RequiresSession List<ServiceConfigEntity> findByService(Long clusterId, String serviceName); @RequiresSession List<ServiceConfigEntity> getLastServiceConfigVersionsForGroups(Collection<Long> configGroupIds); @RequiresSession ServiceConfigEntity getLastServiceConfigVersionsForGroup(Long configGroupId); @RequiresSession List<Long> getServiceConfigVersionsByConfig(Long clusterId, String configType, Long configVersion); @RequiresSession List<ServiceConfigEntity> getLastServiceConfigs(Long clusterId); @RequiresSession List<ServiceConfigEntity> getLastServiceConfigsForService(Long clusterId, String serviceName); @RequiresSession ServiceConfigEntity getLastServiceConfigForServiceDefaultGroup(Long clusterId, String serviceName); @RequiresSession List<ServiceConfigEntity> getServiceConfigsForServiceAndStack(Long clusterId,
      StackId stackId, String serviceName); @RequiresSession List<ServiceConfigEntity> getLatestServiceConfigs(Long clusterId,
      StackId stackId); @RequiresSession ServiceConfigEntity getLastServiceConfig(Long clusterId, String serviceName); @RequiresSession ServiceConfigEntity findMaxVersion(Long clusterId, String serviceName); @RequiresSession List<ServiceConfigEntity> getServiceConfigs(Long clusterId); @RequiresSession List<ServiceConfigEntity> findAll(); @RequiresSession Long findNextServiceConfigVersion(long clusterId, String serviceName); @Transactional void removeHostFromServiceConfigs(final Long hostId); @Transactional void create(ServiceConfigEntity serviceConfigEntity); @Transactional ServiceConfigEntity merge(ServiceConfigEntity serviceConfigEntity); @Transactional void remove(ServiceConfigEntity serviceConfigEntity);  }### Answer:
@Test public void testGetAllServiceConfigs() throws Exception { ServiceConfigEntity serviceConfigEntity = null; serviceConfigEntity = createServiceConfig("HDFS", "admin", 1L, 1L, 10L, null); serviceConfigEntity = createServiceConfig("HDFS", "admin", 2L, 2L, 20L, null); serviceConfigEntity = createServiceConfig("HDFS", "admin", 3L, 3L, 30L, null); serviceConfigEntity = createServiceConfig("YARN", "admin", 1L, 4L, 40L, null); long clusterId = serviceConfigEntity.getClusterId(); List<ServiceConfigEntity> serviceConfigs = serviceConfigDAO.getServiceConfigsForServiceAndStack( clusterId, HDP_01, "HDFS"); Assert.assertEquals(3, serviceConfigs.size()); serviceConfigs = serviceConfigDAO.getServiceConfigsForServiceAndStack(clusterId, HDP_01, "YARN"); Assert.assertEquals(1, serviceConfigs.size()); serviceConfigs = serviceConfigDAO.getServiceConfigsForServiceAndStack(clusterId, HDP_02, "HDFS"); Assert.assertEquals(0, serviceConfigs.size()); }