Skip to content

Commit

Permalink
georgberky#9 WIP: ArtifactVersionComparisonTest
Browse files Browse the repository at this point in the history
Co-Authored-By: Sandra Parsick <[email protected]>
Co-Authored-By: Karl Heinz Marbaise <[email protected]>
                                                    u
  • Loading branch information
georgberky and sparsick committed May 18, 2021
1 parent e4c0152 commit 1bcd3a8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 15 deletions.
22 changes: 21 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<maven.version>3.6.3</maven.version>
<kotlin.version>1.3.71</kotlin.version>
<maven-plugin.version>3.6.0</maven-plugin.version>
<itf.version>0.9.0</itf.version>
<itf.version>0.10.0-SNAPSHOT</itf.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
Expand Down Expand Up @@ -145,10 +145,21 @@
<testResource>
<directory>src/test/resources-its</directory>
<filtering>true</filtering>
<includes>
<include>**/pom.xml</include>
</includes>
</testResource>
<testResource>
<directory>src/test/resources-its</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</testResource>
</testResources>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>

<pluginManagement>
<plugins>
<plugin>
Expand All @@ -158,7 +169,16 @@
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<addDefaultExcludes>false</addDefaultExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
Expand Down
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)
}
}
26 changes: 12 additions & 14 deletions src/test/kotlin/com/github/helpermethod/UpdateMojoNativeGitIT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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") }
Expand Down

0 comments on commit 1bcd3a8

Please sign in to comment.