forked from georgberky/dependency-update-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
georgberky#9 WIP: ArtifactVersionComparisonTest
Co-Authored-By: Sandra Parsick <[email protected]> Co-Authored-By: Karl Heinz Marbaise <[email protected]> u
- Loading branch information
1 parent
e4c0152
commit 1bcd3a8
Showing
3 changed files
with
48 additions
and
15 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
15 changes: 15 additions & 0 deletions
15
src/test/kotlin/com/github/helpermethod/ArtifactVersionComparisonTest.kt
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,15 @@ | ||
package com.github.helpermethod | ||
|
||
import org.apache.maven.artifact.versioning.ArtifactVersion | ||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
|
||
class ArtifactVersionComparisonTest { | ||
@Test | ||
internal fun sameVersionIsEqual() { | ||
val version = DefaultArtifactVersion("1.0.0") | ||
|
||
assertThat(version).isEqualTo(version) | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ package com.github.helpermethod | |
import com.soebes.itf.jupiter.extension.* | ||
import com.soebes.itf.extension.assertj.MavenExecutionResultAssert.assertThat as mavenAssertThat | ||
import com.soebes.itf.jupiter.maven.MavenExecutionResult | ||
import com.soebes.itf.jupiter.maven.MavenProjectResult | ||
import org.assertj.core.api.Assertions | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.eclipse.jgit.api.Git | ||
|
@@ -13,30 +14,27 @@ import java.util.stream.Collectors.toList | |
@MavenJupiterExtension | ||
@MavenProject("nativeProviderIsSet") | ||
internal class UpdateMojoNativeGitIT { | ||
//TODO: add test for making connectionUrl or developerConnection mandatory only if provider == JGIT | ||
lateinit var repo : Git | ||
lateinit var repo: Git | ||
|
||
@BeforeEach | ||
internal fun setUp() { | ||
val baseDir = File(System.getProperty("basedir", System.getProperty("user.dir", ".")), "target/maven-it") | ||
val repoPath = File(baseDir, this.javaClass.name.replace('.', '/') + "/nativeProviderIsSet/project") | ||
internal fun setUp(result: MavenProjectResult) { | ||
repo = Git.open(result.targetProjectDirectory) | ||
|
||
repo = Git.init() | ||
.setDirectory(repoPath) | ||
.call() | ||
|
||
repo.add().addFilepattern(".").call() | ||
repo.commit().setAuthor("Schorsch", "[email protected]").setMessage("initial commit").call() | ||
|
||
assertThat(repo.status().call().isClean).isTrue() | ||
repo.add().addFilepattern(".").call(); | ||
repo.commit().setAuthor("Schorsch", "[email protected]").setMessage("interpolate version").call() | ||
} | ||
|
||
@MavenTest | ||
@MavenDebug | ||
@MavenGoal("\${project.groupId}:\${project.artifactId}:\${project.version}:update") | ||
fun nativeProviderIsSet(result: MavenExecutionResult) { | ||
mavenAssertThat(result).isSuccessful() | ||
|
||
val branchList = repo.branchList().call().stream().map { it.name }.collect(toList()) | ||
|
||
mavenAssertThat(result) | ||
.describedAs("the build should have been successful") | ||
.isSuccessful() | ||
|
||
assertThat(branchList) | ||
.describedAs("feature branch for junit-jupiter should be created") | ||
.filteredOn { it.startsWith("dependency-update/org.junit.jupiter-junit-jupiter") } | ||
|