-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
315199d
commit f3909f8
Showing
49 changed files
with
1,189 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...core.tests/src/test/java/org/sonarlint/eclipse/core/internal/markers/MarkerFlowsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* SonarLint for Eclipse | ||
* Copyright (C) 2015-2021 SonarSource SA | ||
* [email protected] | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
package org.sonarlint.eclipse.core.internal.markers; | ||
|
||
import java.util.Arrays; | ||
import org.junit.Test; | ||
import org.sonarlint.eclipse.tests.common.SonarTestCase; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class MarkerFlowsTest extends SonarTestCase { | ||
|
||
@Test | ||
public void display_a_correct_summary_for_secondary_locations_only_flows() { | ||
MarkerFlow flow1 = new MarkerFlow(0); | ||
new MarkerFlowLocation(flow1, "message1"); | ||
MarkerFlow flow2 = new MarkerFlow(0); | ||
new MarkerFlowLocation(flow2, "message2"); | ||
MarkerFlow flow3 = new MarkerFlow(0); | ||
new MarkerFlowLocation(flow3, "message3"); | ||
MarkerFlows markerFlows = new MarkerFlows(Arrays.asList(flow1, flow2, flow3)); | ||
|
||
assertThat(markerFlows.getSummaryDescription()).isEqualTo(" [+3 locations]"); | ||
} | ||
|
||
@Test | ||
public void display_a_correct_summary_for_multiple_flows() { | ||
MarkerFlow flow1 = new MarkerFlow(0); | ||
new MarkerFlowLocation(flow1, "message1"); | ||
new MarkerFlowLocation(flow1, "message11"); | ||
MarkerFlow flow2 = new MarkerFlow(0); | ||
new MarkerFlowLocation(flow2, "message2"); | ||
new MarkerFlowLocation(flow2, "message22"); | ||
MarkerFlow flow3 = new MarkerFlow(0); | ||
new MarkerFlowLocation(flow3, "message3"); | ||
new MarkerFlowLocation(flow3, "message33"); | ||
MarkerFlows markerFlows = new MarkerFlows(Arrays.asList(flow1, flow2, flow3)); | ||
|
||
assertThat(markerFlows.getSummaryDescription()).isEqualTo(" [+3 flows]"); | ||
} | ||
|
||
@Test | ||
public void display_a_correct_summary_for_single_flow() { | ||
MarkerFlow flow1 = new MarkerFlow(0); | ||
new MarkerFlowLocation(flow1, "message1"); | ||
new MarkerFlowLocation(flow1, "message11"); | ||
new MarkerFlowLocation(flow1, "message111"); | ||
MarkerFlows markerFlows = new MarkerFlows(Arrays.asList(flow1)); | ||
|
||
assertThat(markerFlows.getSummaryDescription()).isEqualTo(" [+3 locations]"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.