aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-application-maven-plugin/src/test/java/com/yahoo/container/plugin/mojo/ApplicationMojoTest.java
blob: 31bb4eddea57ffc62634ca4e35f833a1e5422fdf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.mojo;

import org.junit.Test;

import java.io.File;

import static com.yahoo.container.plugin.mojo.ApplicationMojo.ignoredFilesFilter;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
 * @author jonmv
 */
public class ApplicationMojoTest {

    @Test
    public void it_does_not_include_files_to_be_ignored() {
        var dsStore = new File("target/classes/.DS_Store");
        assertFalse(ignoredFilesFilter().accept(dsStore));
    }

    @Test
    public void testRegex() {
        assertTrue(ApplicationMojo.isVespaParent("ai.vespa"));
        assertTrue(ApplicationMojo.isVespaParent("ai.vespa.hosted"));
        assertTrue(ApplicationMojo.isVespaParent("com.yahoo.vespa"));
        assertTrue(ApplicationMojo.isVespaParent("com.yahoo.vespa.hosted"));

        assertFalse(ApplicationMojo.isVespaParent("ai"));
        assertFalse(ApplicationMojo.isVespaParent("ai.vespa."));
        assertFalse(ApplicationMojo.isVespaParent("ai.vespaxxx."));
        assertFalse(ApplicationMojo.isVespaParent("com.yahoo"));
        assertFalse(ApplicationMojo.isVespaParent("com.yahoo.vespa."));
        assertFalse(ApplicationMojo.isVespaParent("com.yahoo.vespaxxx"));
    }

}