forked from objectionary/eo
-
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.
- Loading branch information
Showing
2 changed files
with
88 additions
and
35 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
eo-maven-plugin/src/test/java/org/eolang/maven/ResolveMojoIT.java
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,88 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
package org.eolang.maven; | ||
|
||
import com.jcabi.manifests.Manifests; | ||
import com.yegor256.MayBeSlow; | ||
import com.yegor256.Mktmp; | ||
import com.yegor256.MktmpResolver; | ||
import com.yegor256.WeAreOnline; | ||
import com.yegor256.farea.Farea; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* Integration tests for {@link ResolveMojo}. | ||
* | ||
* @since 0.52 | ||
*/ | ||
@SuppressWarnings({"JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleNotContainsTestWord"}) | ||
@ExtendWith({WeAreOnline.class, MktmpResolver.class, MayBeSlow.class}) | ||
final class ResolveMojoIT { | ||
@Test | ||
void resolvesJarFile(@Mktmp final Path temp) throws IOException { | ||
new Farea(temp).together( | ||
f -> { | ||
ResolveMojoIT.configureFarea(f); | ||
f.exec("process-classes"); | ||
MatcherAssert.assertThat( | ||
"the jar file was resolved and unpacked", | ||
f.files().file( | ||
String.format( | ||
"target/eo/%s/org.eolang/eo-runtime/-/0.39.0/org/eolang/Phi.class", | ||
ResolveMojo.DIR | ||
) | ||
).exists(), | ||
Matchers.is(true) | ||
); | ||
} | ||
); | ||
} | ||
|
||
@Test | ||
void removesOldJarFile(@Mktmp final Path temp) throws IOException { | ||
new Farea(temp).together( | ||
f -> { | ||
ResolveMojoIT.configureFarea(f); | ||
f.exec("process-classes"); | ||
f.dependencies() | ||
.append("org.eolang", "eo-runtime", "0.40.0"); | ||
f.exec("process-classes"); | ||
MatcherAssert.assertThat( | ||
"binary files from the old JAR were removed", | ||
f.files().file( | ||
String.format( | ||
"target/eo/%s/org.eolang/eo-runtime/-/0.39.0", | ||
ResolveMojo.DIR | ||
) | ||
).exists(), | ||
Matchers.is(false) | ||
); | ||
} | ||
); | ||
} | ||
|
||
private static void configureFarea(final Farea farea) throws IOException { | ||
farea.clean(); | ||
farea.dependencies() | ||
.append("org.eolang", "eo-runtime", "0.39.0"); | ||
farea.build() | ||
.plugins() | ||
.append( | ||
"org.eolang", | ||
"eo-maven-plugin", | ||
System.getProperty( | ||
"eo.version", | ||
Manifests.read("EO-Version") | ||
) | ||
) | ||
.execution() | ||
.goals("resolve"); | ||
} | ||
} |
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