Skip to content

Commit

Permalink
objectionary#3236 add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
c71n93 committed Jul 19, 2024
1 parent 40830db commit 6c7c4a6
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
package org.eolang.maven;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

class DownloadJnaMojoTest {

private static final Path OUT = Paths.get("target/classes");

private static final String JNA_JAR = "jna-5.14.0.jar";

@Test
void executesWithoutErrors(@TempDir final Path temp) {
Assertions.assertDoesNotThrow(
() -> new FakeMaven(temp).execute(DownloadJnaMojo.class),
"Exception shouldn't been thrown"
);
}
}

@Test
void createsOutDir(@TempDir final Path temp) throws IOException {
new FakeMaven(temp).execute(DownloadJnaMojo.class);
Assertions.assertTrue(
Files.exists(temp.resolve(OUT))
);
}

@Test
void downloadsCorrectly(@TempDir final Path temp) throws IOException {
new FakeMaven(temp).execute(DownloadJnaMojo.class);
Assertions.assertTrue(
Files.exists(temp.resolve(OUT).resolve(JNA_JAR))
);
}
}

0 comments on commit 6c7c4a6

Please sign in to comment.