ReleaseService { public List<Release> findByReleaseKeys(Set<String> releaseKeys) { return releaseRepository.findByReleaseKeyIn(releaseKeys); } ReleaseService(
      final ReleaseRepository releaseRepository,
      final ItemService itemService,
      final AuditService auditService,
      final NamespaceLockService namespaceLockService,
      final NamespaceService namespaceService,
      final NamespaceBranchService namespaceBranchService,
      final ReleaseHistoryService releaseHistoryService,
      final ItemSetService itemSetService); Release findOne(long releaseId); Release findActiveOne(long releaseId); List<Release> findByReleaseIds(Set<Long> releaseIds); List<Release> findByReleaseKeys(Set<String> releaseKeys); Release findLatestActiveRelease(Namespace namespace); Release findLatestActiveRelease(String appId, String clusterName, String namespaceName); List<Release> findAllReleases(String appId, String clusterName, String namespaceName, Pageable page); List<Release> findActiveReleases(String appId, String clusterName, String namespaceName, Pageable page); @Transactional Release mergeBranchChangeSetsAndRelease(Namespace namespace, String branchName, String releaseName,
                                                 String releaseComment, boolean isEmergencyPublish,
                                                 ItemChangeSets changeSets); @Transactional Release publish(Namespace namespace, String releaseName, String releaseComment,
                         String operator, boolean isEmergencyPublish); @Transactional Release grayDeletionPublish(Namespace namespace, String releaseName, String releaseComment,
                                     String operator, boolean isEmergencyPublish, Set<String> grayDelKeys); @Transactional Release rollback(long releaseId, String operator); @Transactional Release rollbackTo(long releaseId, long toReleaseId, String operator); @Transactional int batchDelete(String appId, String clusterName, String namespaceName, String operator);  }
@Test public void testFindByReleaseKeys() throws Exception { Release someRelease = mock(Release.class); Release anotherRelease = mock(Release.class); String someReleaseKey = "key1"; String anotherReleaseKey = "key2"; List<Release> someReleases = Lists.newArrayList(someRelease, anotherRelease); Set<String> someReleaseKeys = Sets.newHashSet(someReleaseKey, anotherReleaseKey); when(releaseRepository.findByReleaseKeyIn(someReleaseKeys)).thenReturn(someReleases); List<Release> result = releaseService.findByReleaseKeys(someReleaseKeys); assertEquals(someReleases, result); }