Author: tchemit Date: 2009-09-27 21:09:25 +0200 (Sun, 27 Sep 2009) New Revision: 594 Modified: trunk/src/test/java/org/nuiton/license/plugin/LicensePluginTest.java Log: add comments on test + use pomFile directory for license to treate (reflects more the real world) Modified: trunk/src/test/java/org/nuiton/license/plugin/LicensePluginTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/LicensePluginTest.java 2009-09-27 19:06:50 UTC (rev 593) +++ trunk/src/test/java/org/nuiton/license/plugin/LicensePluginTest.java 2009-09-27 19:09:25 UTC (rev 594) @@ -37,7 +37,8 @@ @Override protected void setUpMojo(LicensePlugin mojo, File pomFile) throws Exception { super.setUpMojo(mojo, pomFile); - File outputDirectory = new File(getBasedir(), mojo.getOutputDirectory().toString()); + // license is where the pom is + File outputDirectory = pomFile.getParentFile(); mojo.setOutputDirectory(outputDirectory); if (!outputDirectory.exists()) { if (!outputDirectory.mkdirs()) { @@ -45,6 +46,9 @@ } } mojo.setLicenseFile(new File(pomFile.getParentFile(), mojo.getLicenseFile().toString())); + log.info("pom : " + getRelativePathFromBasedir(mojo.getProject().getFile())); + log.info("outputDirectory : " + getRelativePathFromBasedir(mojo.getOutputDirectory())); + log.info("licenseFile : " + getRelativePathFromBasedir(mojo.getLicenseFile())); } @Test @@ -58,12 +62,14 @@ // since we can not ensure order of copy test resources mojo.getProject().getFile().setLastModified(0); + // then executing the mojo, will do NOT change the licence file mojo.execute(); long t1 = mojo.getLicenseFile().lastModified(); assertEquals(t0, t1); + // force to override the license file mojo.setForce(true); mojo.execute(); @@ -83,12 +89,14 @@ // since we can not ensure order of copy test resources mojo.getProject().getFile().setLastModified(0); + // then executing the mojo, will do NOT change the licence file mojo.execute(); long t1 = mojo.getLicenseFile().lastModified(); assertEquals(t0, t1); + // force to override the license file mojo.setForce(true); mojo.execute();