-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MSHARED-1341] Convert tests to Junit 5
- Loading branch information
1 parent
9758357
commit 352ba44
Showing
16 changed files
with
280 additions
and
198 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,39 +21,39 @@ | |
import java.util.LinkedHashSet; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
/** | ||
* @author Karl Heinz Marbaise <a href="mailto:[email protected]">[email protected]</a>. | ||
*/ | ||
public class AbstractMavenFilteringRequestTest { | ||
class AbstractMavenFilteringRequestTest { | ||
|
||
private AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
private LinkedHashSet<String> delimiters = new LinkedHashSet<>(); | ||
|
||
@Test | ||
public void setDelimitersShouldNotChangeAnythingIfUsingNull() { | ||
void setDelimitersShouldNotChangeAnythingIfUsingNull() { | ||
request.setDelimiters(null, false); | ||
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@")); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldNotChangeAnythingIfUsingEmpty() { | ||
void setDelimitersShouldNotChangeAnythingIfUsingEmpty() { | ||
request.setDelimiters(delimiters, false); | ||
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@")); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddOnlyTheGivenDelimiter() { | ||
void setDelimitersShouldAddOnlyTheGivenDelimiter() { | ||
delimiters.add("test"); | ||
request.setDelimiters(delimiters, false); | ||
assertThat(request.getDelimiters(), Matchers.contains("test")); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersForNullElements() { | ||
void setDelimitersShouldAddDefaultDelimitersForNullElements() { | ||
delimiters.add("test"); | ||
delimiters.add(null); | ||
delimiters.add("second"); | ||
|
@@ -62,27 +62,27 @@ public void setDelimitersShouldAddDefaultDelimitersForNullElements() { | |
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNullGiven() { | ||
void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNullGiven() { | ||
request.setDelimiters(null, true); | ||
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@")); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNotNullGiven() { | ||
void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNotNullGiven() { | ||
LinkedHashSet<String> delimiters = new LinkedHashSet<>(); | ||
request.setDelimiters(delimiters, true); | ||
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@")); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfSingleElementIsGiven() { | ||
void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfSingleElementIsGiven() { | ||
delimiters.add("test"); | ||
request.setDelimiters(delimiters, true); | ||
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@", "test")); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersForNullElement() { | ||
void setDelimitersShouldAddDefaultDelimitersForNullElement() { | ||
delimiters.add("test"); | ||
delimiters.add(null); | ||
delimiters.add("second"); | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,19 +18,28 @@ | |
*/ | ||
package org.apache.maven.shared.filtering; | ||
|
||
import javax.inject.Inject; | ||
|
||
import java.io.Reader; | ||
import java.io.StringReader; | ||
import java.util.Properties; | ||
|
||
import org.apache.commons.io.IOUtils; | ||
import org.codehaus.plexus.testing.PlexusTest; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
/** | ||
* @author Kristian Rosenvold | ||
*/ | ||
public class DefaultMavenReaderFilterTest extends TestSupport { | ||
public void testJustDoSomeFiltering() throws Exception { | ||
MavenReaderFilter readerFilter = lookup(MavenReaderFilter.class); | ||
@PlexusTest | ||
class DefaultMavenReaderFilterTest { | ||
@Inject | ||
MavenReaderFilter readerFilter; | ||
|
||
@Test | ||
void justDoSomeFiltering() throws Exception { | ||
StringReader src = new StringReader("[email protected] ${foo}"); | ||
MavenReaderFilterRequest req = new MavenReaderFilterRequest(); | ||
Properties additionalProperties = new Properties(); | ||
|
Oops, something went wrong.