-
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.
Merge pull request #7 from apache/deps
[MSHARED-901] update test dependencies
- Loading branch information
Showing
3 changed files
with
25 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,6 @@ out/ | |
/bootstrap | ||
/dependencies.xml | ||
.java-version | ||
*.versionsBackup | ||
.checkstyle | ||
|
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package org.apache.maven.shared.filtering; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
|
@@ -19,93 +21,86 @@ | |
* under the License. | ||
*/ | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.LinkedHashSet; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.junit.Test; | ||
|
||
/** | ||
* @author Karl Heinz Marbaise <a href="mailto:[email protected]>[email protected]</a>. | ||
*/ | ||
public class AbstractMavenFilteringRequestTest | ||
{ | ||
|
||
private AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
private LinkedHashSet<String> delimiters = new LinkedHashSet<>(); | ||
|
||
@Test | ||
public void setDelimitersShouldNotChangeAnythingIfUsingNull() | ||
{ | ||
AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
request.setDelimiters( null, false ); | ||
assertThat( request.getDelimiters() ).containsExactly( "${*}", "@" ); | ||
assertThat( request.getDelimiters(), Matchers.contains( "${*}", "@" ) ); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldNotChangeAnythingIfUsingEmpty() | ||
{ | ||
AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
LinkedHashSet<String> delimiters = new LinkedHashSet<>(); | ||
request.setDelimiters( delimiters, false ); | ||
assertThat( request.getDelimiters() ).containsExactly( "${*}", "@" ); | ||
assertThat( request.getDelimiters(), Matchers.contains( "${*}", "@" ) ); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddOnlyTheGivenDelimiter() | ||
{ | ||
AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
LinkedHashSet<String> delimiters = new LinkedHashSet<>(); | ||
delimiters.add( "test" ); | ||
request.setDelimiters( delimiters, false ); | ||
assertThat( request.getDelimiters() ).containsExactly( "test" ); | ||
assertThat( request.getDelimiters(), Matchers.contains( "test" ) ); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersForNullElements() | ||
{ | ||
AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
LinkedHashSet<String> delimiters = new LinkedHashSet<>(); | ||
delimiters.add( "test" ); | ||
delimiters.add( null ); | ||
delimiters.add( "second" ); | ||
request.setDelimiters( delimiters, false ); | ||
assertThat( request.getDelimiters() ).containsExactly( "test", "${*}", "second" ); | ||
assertThat( request.getDelimiters(), Matchers.contains( "test", "${*}", "second" ) ); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNullGiven() | ||
{ | ||
AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
request.setDelimiters( null, true ); | ||
assertThat( request.getDelimiters() ).containsExactly( "${*}", "@" ); | ||
assertThat( request.getDelimiters(), Matchers.contains( "${*}", "@" ) ); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNotNullGiven() | ||
{ | ||
AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
LinkedHashSet<String> delimiters = new LinkedHashSet<>(); | ||
request.setDelimiters( delimiters, true ); | ||
assertThat( request.getDelimiters() ).containsExactly( "${*}", "@" ); | ||
assertThat( request.getDelimiters(), Matchers.contains( "${*}", "@" ) ); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfSingleElementIsGiven() | ||
{ | ||
AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
LinkedHashSet<String> delimiters = new LinkedHashSet<>(); | ||
delimiters.add( "test" ); | ||
request.setDelimiters( delimiters, true ); | ||
assertThat( request.getDelimiters() ).containsExactly( "${*}", "@", "test" ); | ||
assertThat( request.getDelimiters(), Matchers.contains( "${*}", "@", "test" ) ); | ||
} | ||
|
||
@Test | ||
public void setDelimitersShouldAddDefaultDelimitersForNullElement() | ||
{ | ||
AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest(); | ||
LinkedHashSet<String> delimiters = new LinkedHashSet<>(); | ||
delimiters.add( "test" ); | ||
delimiters.add( null ); | ||
delimiters.add( "second" ); | ||
request.setDelimiters( delimiters, true ); | ||
assertThat( request.getDelimiters() ).containsExactly( "${*}", "@", "test", "second" ); | ||
assertThat( request.getDelimiters(), Matchers.contains( "${*}", "@", "test", "second" ) ); | ||
} | ||
|
||
} |