Package org.apache.maven.plugin.testing.stubs

Examples of org.apache.maven.plugin.testing.stubs.MavenProjectStub


    @Test(expectedExceptions = MojoExecutionException.class)
    public void test_fail() throws Exception {
        LicenseCheckMojo check = new LicenseCheckMojo();
        check.basedir = new File("src/test/resources/check");
        check.header = "header.txt";
        check.project = new MavenProjectStub();
        check.execute();
    }
View Full Code Here


    @Test
    public void test_not_fail() throws Exception {
        LicenseCheckMojo check = new LicenseCheckMojo();
        check.basedir = new File("src/test/resources/check");
        check.header = "header.txt";
        check.project = new MavenProjectStub();
        check.failIfMissing = false;
        check.execute();
    }
View Full Code Here

        FileUtils.copyFileToFolder(new File("src/test/resources/update/doc2.txt"), tmp);

        LicenseFormatMojo updater = new LicenseFormatMojo();
        updater.basedir = tmp;
        updater.header = "src/test/resources/update/header.txt";
        updater.project = new MavenProjectStub();
        updater.execute();

        assertEquals(FileUtils.read(new File(tmp, "doc1.txt"), System.getProperty("file.encoding")), "====\r\n    My Copyright license 2\r\n====\r\nsome data\r\n");
        assertEquals(FileUtils.read(new File(tmp, "doc2.txt"), System.getProperty("file.encoding")), "====\r\n    My Copyright license 2\r\n====\r\nsome data\r\n");
    }
View Full Code Here

        FileUtils.copyFileToFolder(new File("src/test/resources/remove/doc2.txt"), tmp);
       
        LicenseRemoveMojo remove = new LicenseRemoveMojo();
        remove.basedir = tmp;
        remove.header = "src/test/resources/remove/header.txt";
        remove.project = new MavenProjectStub();
        remove.execute();

        assertEquals(FileUtils.read(new File(tmp, "doc1.txt"), System.getProperty("file.encoding")), "some data\r\n");
        assertEquals(FileUtils.read(new File(tmp, "doc2.txt"), System.getProperty("file.encoding")), "some data\r\n");
    }
View Full Code Here

    @Test
    public void test_include() throws Exception {
        LicenseCheckMojo check = new LicenseCheckMojo();
        check.basedir = new File("src/test/resources/check");
        check.header = "header.txt";
        check.project = new MavenProjectStub();
        check.includes = new String[] {"inexisting"};
        check.execute();
    }
View Full Code Here

    @Test(expectedExceptions = MojoExecutionException.class)
    public void test_include_and_fail() throws Exception {
        LicenseCheckMojo check = new LicenseCheckMojo();
        check.basedir = new File("src/test/resources/check");
        check.header = "header.txt";
        check.project = new MavenProjectStub();
        check.includes = new String[] {"doc1.txt"};
        check.execute();
    }
View Full Code Here

    @Test
    public void test_load_header_from_relative_file() throws Exception {
        LicenseCheckMojo check = new LicenseCheckMojo();
        check.basedir = new File("src/test/resources/check");
        check.header = "header.txt";
        check.project = new MavenProjectStub();
        check.failIfMissing = false;

        MockedLog logger = new MockedLog();
        check.setLog(new DefaultLog(logger));
View Full Code Here

    @Test
    public void test_additionalHeaderDefinitions() throws Exception {
        LicenseCheckMojo check = new LicenseCheckMojo();
        check.basedir = new File("src/test/resources/check/def");
        check.header = "src/test/resources/check/header.txt";
        check.project = new MavenProjectStub();
        check.excludes = new String[] {"*.xml"};

        try {
            check.execute();
            fail();
View Full Code Here

* @author Mathieu Carbou (mathieu.carbou@gmail.com)
*/
public final class AggregateMojoTest {
    @Test
    public void test_modules_ignored() throws Exception {
        MavenProjectStub project = new MavenProjectStub() {
            @Override
            public List getModules() {
                return Arrays.<String>asList("module1", "module2", "module3");
            }
        };
View Full Code Here

        check.execute();
    }

    @Test
    public void test_modules_scanned() throws Exception {
        MavenProjectStub project = new MavenProjectStub() {
            @Override
            public List getModules() {
                return Arrays.<String>asList("module1", "module2", "module3");
            }
        };
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.testing.stubs.MavenProjectStub

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.