Skip to content

Commit

Permalink
[MGPG-107] Settle on JUnit 5 (#70)
Browse files Browse the repository at this point in the history
No need for another library just to perform 4 assertions.

---

https://issues.apache.org/jira/browse/MGPG-107
  • Loading branch information
cstamas authored Mar 3, 2024
1 parent 0b66b07 commit 6081ad4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
5 changes: 0 additions & 5 deletions pgp-keys-map.list
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@ commons-io:commons-io = 0x2DB4F1EF0FA761ECC4EA935C86FDC7E2A11262CB
javax.inject:javax.inject = noSig
org.apiguardian:apiguardian-api = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
org.junit.jupiter:junit-jupiter-api = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
org.junit.jupiter:junit-jupiter-engine = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
org.junit.jupiter:junit-jupiter-params = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
org.junit.jupiter:junit-jupiter = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
org.junit.platform:junit-platform-commons = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
org.junit.platform:junit-platform-engine = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
org.opentest4j:opentest4j = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
net.bytebuddy:byte-buddy = 0xB4AC8CDC141AF0AE468D16921DA784CCB5C46DD5
org.assertj:assertj-core = 0xBE685132AFD2740D9095F9040CC0B712FEE75827
org.apache.maven.resolver = 0x522CA055B326A636D833EF6A0551FD3684FCBBB7
org.apache.maven.shared:maven-invoker = 0x84789D24DF77A32433CE1F079EB80E92EB2135B1
org.codehaus.plexus:plexus-cipher = 0x6A814B1F869C2BBEAB7CB7271A2A1C94BDE89688
Expand Down
8 changes: 1 addition & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,9 @@ under the License.
<version>2.0</version>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.25.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class GpgSignArtifactIT {
private final File mavenHome;
Expand Down Expand Up @@ -80,7 +82,13 @@ void testPlacementOfArtifactInOutputDirectory(String pomPath, String expectedFil
InvokerTestUtils.executeRequest(request, mavenHome, localRepository);

// then
assertThat(expectedOutputDirectory).exists();
assertThat(expectedOutputDirectory.list()).containsExactlyInAnyOrder(expectedFiles);
assertTrue(expectedOutputDirectory.isDirectory());

String[] outputFiles = expectedOutputDirectory.list();
assertNotNull(outputFiles);

Arrays.sort(outputFiles);
Arrays.sort(expectedFiles);
assertEquals(Arrays.toString(expectedFiles), Arrays.toString(outputFiles));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import org.codehaus.plexus.util.FileUtils;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class GpgSignAttachedMojoIT {

Expand Down Expand Up @@ -58,11 +59,9 @@ void testInteractiveWithoutPassphrase() throws Exception {
final String buildLogContent = FileUtils.fileRead(result.getBuildLog());

// then
assertThat(invocationResult.getExitCode())
.as("Maven execution must fail")
.isNotEqualTo(0);
assertThat(buildLogContent)
.as("Maven execution failed because no pinentry program is available")
.contains("[GNUPG:] FAILURE sign 67108949");
assertNotEquals(0, invocationResult.getExitCode(), "Maven execution must fail");
assertTrue(
buildLogContent.contains("[GNUPG:] FAILURE sign 67108949"),
"Maven execution failed because no pinentry program is available");
}
}

0 comments on commit 6081ad4

Please sign in to comment.