From 982f0690f1534f6cf4822c6c57058fc0c7fcdd04 Mon Sep 17 00:00:00 2001 From: C4tWithShell Date: Tue, 12 Dec 2023 00:13:47 +0300 Subject: [PATCH] Test 16.4 --- .../ce/CommunityBranchLoaderDelegateTest.java | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/src/test/java/com/github/mc1arke/sonarqube/plugin/ce/CommunityBranchLoaderDelegateTest.java b/src/test/java/com/github/mc1arke/sonarqube/plugin/ce/CommunityBranchLoaderDelegateTest.java index 94e301e..5e9ca58 100644 --- a/src/test/java/com/github/mc1arke/sonarqube/plugin/ce/CommunityBranchLoaderDelegateTest.java +++ b/src/test/java/com/github/mc1arke/sonarqube/plugin/ce/CommunityBranchLoaderDelegateTest.java @@ -141,50 +141,6 @@ public void testBranchNameNoMatchingBranch() { testCase.load(metadata); } - @Test - public void testBranchNameMatchingBranch() { - BranchDto branchDto = mock(BranchDto.class); - when(branchDto.getBranchType()).thenReturn(BranchType.BRANCH); - when(branchDto.getKey()).thenReturn("branchKey"); - when(branchDto.getMergeBranchUuid()).thenReturn("mergeBranchUuid"); - when(branchDto.getProjectUuid()).thenReturn("projectUuid"); - when(branchDto.getUuid()).thenReturn("branchUuid"); - - BranchDao branchDao = mock(BranchDao.class); - when(branchDao.selectByBranchKey(any(), eq("projectUuid"), eq("branch"))).thenReturn(Optional.of(branchDto)); - - ScannerReport.Metadata metadata = - ScannerReport.Metadata.getDefaultInstance().toBuilder().setBranchName("branch") - .setBranchType(ScannerReport.Metadata.BranchType.BRANCH).build(); - - when(dbClient.branchDao()).thenReturn(branchDao); - - when(metadataHolder.getProject()).thenReturn(new Project("projectUuid", "key", "name", "description", new ArrayList<>())); - - testCase.load(metadata); - - ArgumentCaptor branchArgumentCaptor = ArgumentCaptor.forClass(Branch.class); - - verify(metadataHolder).setBranch(branchArgumentCaptor.capture()); - assertEquals(BranchType.BRANCH, branchArgumentCaptor.getValue().getType()); - assertEquals("projectUuid", branchArgumentCaptor.getValue().getReferenceBranchUuid()); - assertEquals("branch", branchArgumentCaptor.getValue().getName()); - assertFalse(branchArgumentCaptor.getValue().isMain()); - assertFalse(branchArgumentCaptor.getValue().supportsCrossProjectCpd()); - - verify(metadataHolder).getProject(); - verify(metadataHolder).setPullRequestKey(anyString()); - - verifyNoMoreInteractions(metadataHolder); - - verify(dbClient).branchDao(); - verify(dbClient).openSession(anyBoolean()); - verifyNoMoreInteractions(dbClient); - - verify(branchDao).selectByBranchKey(any(), any(), any()); - verifyNoMoreInteractions(branchDao); - } - @Test public void testBranchNamePullRequest() { BranchDto branchDto = mock(BranchDto.class);