summaryrefslogtreecommitdiffstats
path: root/vespa-maven-plugin/src/test/java/ai/vespa/hosted/plugin/CompileVersionMojoTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespa-maven-plugin/src/test/java/ai/vespa/hosted/plugin/CompileVersionMojoTest.java')
-rw-r--r--vespa-maven-plugin/src/test/java/ai/vespa/hosted/plugin/CompileVersionMojoTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/vespa-maven-plugin/src/test/java/ai/vespa/hosted/plugin/CompileVersionMojoTest.java b/vespa-maven-plugin/src/test/java/ai/vespa/hosted/plugin/CompileVersionMojoTest.java
new file mode 100644
index 00000000000..ebb91934470
--- /dev/null
+++ b/vespa-maven-plugin/src/test/java/ai/vespa/hosted/plugin/CompileVersionMojoTest.java
@@ -0,0 +1,28 @@
+package ai.vespa.hosted.plugin;
+
+import org.junit.jupiter.api.Test;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.OptionalInt;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * @author mpolden
+ */
+class CompileVersionMojoTest {
+
+ @Test
+ public void allow_major() {
+ assertMajorVersion(OptionalInt.empty(), Paths.get("non-existent-deployment.xml"));
+ assertMajorVersion(OptionalInt.empty(), Paths.get("src/test/resources/deployment.xml"));
+ assertMajorVersion(OptionalInt.of(8), Paths.get("src/test/resources/deployment-with-major.xml"));
+ }
+
+ private void assertMajorVersion(OptionalInt expected, Path deploymentXml) {
+ OptionalInt allowMajor = CompileVersionMojo.majorVersion(deploymentXml);
+ assertEquals(expected, allowMajor);
+ }
+
+}