@@ -66,19 +66,48 @@ public void shouldFailIfNotPreview() {
6666 settings .setProperty (GitHubPlugin .GITHUB_PULL_REQUEST , "1" );
6767
6868 thrown .expect (MessageException .class );
69- thrown .expectMessage ("The GitHub plugin is only intended to be used in preview mode. Please set 'sonar.analysis.mode'." );
69+ thrown .expectMessage ("The GitHub plugin is only intended to be used in preview or issues mode. Please set 'sonar.analysis.mode'." );
7070
7171 pullRequestProjectBuilder .build (null );
7272 }
7373
7474 @ Test
75- public void shouldNotFailIfPreview () {
75+ public void shouldNotFailIfDryRun () {
7676 settings .setProperty (GitHubPlugin .GITHUB_PULL_REQUEST , "1" );
7777 settings .setProperty (CoreProperties .DRY_RUN , "true" );
7878
7979 pullRequestProjectBuilder .build (mock (ProjectBuilder .Context .class , withSettings ().defaultAnswer (RETURNS_DEEP_STUBS )));
8080
8181 verify (facade ).init (eq (1 ), any (File .class ));
82+ }
8283
84+ @ Test
85+ public void shouldNotFailIfPreview () {
86+ settings .setProperty (GitHubPlugin .GITHUB_PULL_REQUEST , "1" );
87+ settings .setProperty (CoreProperties .ANALYSIS_MODE , CoreProperties .ANALYSIS_MODE_PREVIEW );
88+
89+ pullRequestProjectBuilder .build (mock (ProjectBuilder .Context .class , withSettings ().defaultAnswer (RETURNS_DEEP_STUBS )));
90+
91+ verify (facade ).init (eq (1 ), any (File .class ));
92+ }
93+
94+ @ Test
95+ public void shouldNotFailIfIncremental () {
96+ settings .setProperty (GitHubPlugin .GITHUB_PULL_REQUEST , "1" );
97+ settings .setProperty (CoreProperties .ANALYSIS_MODE , CoreProperties .ANALYSIS_MODE_INCREMENTAL );
98+
99+ pullRequestProjectBuilder .build (mock (ProjectBuilder .Context .class , withSettings ().defaultAnswer (RETURNS_DEEP_STUBS )));
100+
101+ verify (facade ).init (eq (1 ), any (File .class ));
102+ }
103+
104+ @ Test
105+ public void shouldNotFailIfIssues () {
106+ settings .setProperty (GitHubPlugin .GITHUB_PULL_REQUEST , "1" );
107+ settings .setProperty (CoreProperties .ANALYSIS_MODE , "issues" );
108+
109+ pullRequestProjectBuilder .build (mock (ProjectBuilder .Context .class , withSettings ().defaultAnswer (RETURNS_DEEP_STUBS )));
110+
111+ verify (facade ).init (eq (1 ), any (File .class ));
83112 }
84113}
0 commit comments