-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from NotMyFault/junit-5
Move to JUnit 5
- Loading branch information
Showing
4 changed files
with
41 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
31 changes: 9 additions & 22 deletions
31
maven-plugin/src/test/java/io/jenkins/tools/incrementals/maven/DetectIndentTest.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 |
---|---|---|
@@ -1,40 +1,27 @@ | ||
package io.jenkins.tools.incrementals.maven; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@RunWith(Parameterized.class) | ||
public class DetectIndentTest { | ||
|
||
@Parameterized.Parameters | ||
public static Collection<Object[]> data() { | ||
return Arrays.asList(new Object[][] { | ||
{ "abc", 0, ' ' }, { " abc", 2, ' ' }, { " abc", 4, ' ' }, { "\t\tabc", 2, '\t' }, { "\tabc", 1, '\t' } | ||
}); | ||
} | ||
|
||
private String input; | ||
|
||
private int size; | ||
|
||
private char type; | ||
|
||
public DetectIndentTest(String input, int size, char type) { | ||
this.input = input; | ||
this.size = size; | ||
this.type = type; | ||
} | ||
|
||
@Test | ||
public void detectIndentSize() { | ||
@ParameterizedTest | ||
@MethodSource("data") | ||
public void detectIndentSize(String input, int size, char type) { | ||
DetectIndent detectIndent = new DetectIndent(); | ||
DetectIndent.Indent indent = detectIndent.detect(input); | ||
Assert.assertEquals(size, indent.size); | ||
Assert.assertEquals(type, indent.type); | ||
assertEquals(size, indent.getSize()); | ||
assertEquals(type, indent.getType()); | ||
} | ||
} |