-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding dry run mode (refs #300)
- Loading branch information
1 parent
8af75db
commit cc71adf
Showing
5 changed files
with
112 additions
and
33 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
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
19 changes: 8 additions & 11 deletions
19
src/test/java/org/jenkinsci/plugins/gwt/GenericTriggerResultsTest.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
43 changes: 43 additions & 0 deletions
43
src/test/java/org/jenkinsci/plugins/gwt/GenericTriggerTest.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,43 @@ | ||
package org.jenkinsci.plugins.gwt; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.jenkinsci.plugins.gwt.GenericTrigger.HEADER_DRY_RUN; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.TreeMap; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class GenericTriggerTest { | ||
|
||
@Test | ||
void testDryRun() { | ||
assertThat(GenericTrigger.isDryRun(null)).isFalse(); | ||
|
||
final Map<String, List<String>> headers = new TreeMap<String, List<String>>(); | ||
assertThat(GenericTrigger.isDryRun(headers)).isFalse(); | ||
|
||
headers.put("whatever", null); | ||
assertThat(GenericTrigger.isDryRun(headers)).isFalse(); | ||
|
||
final List<String> headerValues = Arrays.asList("true"); | ||
headers.put("whatever", headerValues); | ||
assertThat(GenericTrigger.isDryRun(headers)).isFalse(); | ||
|
||
headers.put(HEADER_DRY_RUN, null); | ||
assertThat(GenericTrigger.isDryRun(headers)).isFalse(); | ||
|
||
List<String> dryRunHeaderValues = Arrays.asList("false"); | ||
headers.put(HEADER_DRY_RUN, dryRunHeaderValues); | ||
assertThat(GenericTrigger.isDryRun(headers)).isFalse(); | ||
|
||
dryRunHeaderValues = Arrays.asList("x"); | ||
headers.put(HEADER_DRY_RUN, dryRunHeaderValues); | ||
assertThat(GenericTrigger.isDryRun(headers)).isFalse(); | ||
|
||
dryRunHeaderValues = Arrays.asList("true"); | ||
headers.put(HEADER_DRY_RUN, dryRunHeaderValues); | ||
assertThat(GenericTrigger.isDryRun(headers)).isTrue(); | ||
} | ||
} |