Skip to content

Commit

Permalink
Merge pull request #7 from apache/deps
Browse files Browse the repository at this point in the history
[MSHARED-901] update test dependencies
  • Loading branch information
elharo authored Jun 2, 2020
2 parents a7b89ad + 57987d4 commit 64de258
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ out/
/bootstrap
/dependencies.xml
.java-version
*.versionsBackup
.checkstyle

15 changes: 7 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,20 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
<version>2.28.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>1.7.1</version>
<scope>test</scope>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>

</dependencies>
Expand Down
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
Expand All @@ -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" ) );
}

}

0 comments on commit 64de258

Please sign in to comment.