use of org.apache.maven.plugin.testing.SilentLog in project kotlin by JetBrains.
the class KotlinCompilationFailureExceptionTest method testLocationWithLocation.
@Test
public void testLocationWithLocation() throws Exception {
MavenPluginLogMessageCollector collector = new MavenPluginLogMessageCollector(new SilentLog());
collector.report(CompilerMessageSeverity.ERROR, "Error in file", CompilerMessageLocation.create("myfile.txt", 777, 9, "nothing"));
try {
collector.throwKotlinCompilerException();
fail();
} catch (KotlinCompilationFailureException e) {
assertEquals("myfile.txt:[777,9] Error in file", e.getLongMessage().trim());
}
}
use of org.apache.maven.plugin.testing.SilentLog in project maven-plugins by apache.
the class ReleaseUtilsTestCase method testMergeReleases.
public void testMergeReleases() throws Exception {
Log log = new SilentLog();
ReleaseUtils releaseUtils = new ReleaseUtils(log);
List<Release> firstReleases = new ArrayList<Release>();
List<Release> secondReleases = new ArrayList<Release>();
List<Release> mergedReleases;
mergedReleases = releaseUtils.mergeReleases(firstReleases, secondReleases);
assertEquals("Both empty", 0, mergedReleases.size());
Release release = new Release();
release.setVersion("1.0");
firstReleases.add(release);
mergedReleases = releaseUtils.mergeReleases(firstReleases, secondReleases);
assertEquals("One release in first", 1, mergedReleases.size());
release = new Release();
release.setVersion("1.1");
secondReleases.add(release);
mergedReleases = releaseUtils.mergeReleases(firstReleases, secondReleases);
assertEquals("One release each", 2, mergedReleases.size());
release = new Release();
release.setVersion("1.1");
firstReleases.add(release);
mergedReleases = releaseUtils.mergeReleases(firstReleases, secondReleases);
assertEquals("Two releases in first, one release in second with one version being the same", 2, mergedReleases.size());
release = new Release();
release.setVersion("1.2");
secondReleases.add(release);
mergedReleases = releaseUtils.mergeReleases(firstReleases, secondReleases);
assertEquals("Two releases each with one version being the same", 3, mergedReleases.size());
}
use of org.apache.maven.plugin.testing.SilentLog in project maven-plugins by apache.
the class TestCollectMojo method testSilent.
public void testSilent() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/collect-test/plugin-config.xml");
CollectDependenciesMojo mojo = (CollectDependenciesMojo) lookupMojo("collect", testPom);
mojo.setSilent(false);
assertFalse(mojo.getLog() instanceof SilentLog);
}
use of org.apache.maven.plugin.testing.SilentLog in project maven-plugins by apache.
the class DependencyTestUtils method removeDirectory.
/**
* Deletes a directory and its contents.
*
* @param dir
* The base directory of the included and excluded files.
*
* @throws IOException
* @throws MojoExecutionException
* When a directory failed to get deleted.
*/
public static void removeDirectory(File dir) throws IOException {
if (dir != null) {
Log log = new SilentLog();
FileSetManager fileSetManager = new FileSetManager(log, false);
FileSet fs = new FileSet();
fs.setDirectory(dir.getPath());
fs.addInclude("**/**");
fileSetManager.delete(fs);
}
}
use of org.apache.maven.plugin.testing.SilentLog in project maven-plugins by apache.
the class TestResolveMojo method testSilent.
public void testSilent() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/resolve-test/plugin-config.xml");
ResolveDependenciesMojo mojo = (ResolveDependenciesMojo) lookupMojo("resolve", testPom);
mojo.setSilent(false);
assertFalse(mojo.getLog() instanceof SilentLog);
}
Aggregations