use of org.apache.maven.plugin.testing.SilentLog in project byte-buddy by raphw.
the class ByteBuddyMojoTest method execute.
private void execute(String goal, String target) throws Exception {
Mojo mojo = mojoRule.lookupMojo(goal, new File("src/test/resources/net/bytebuddy/test/" + target + ".pom.xml"));
if (goal.equals("transform")) {
mojoRule.setVariableValueToObject(mojo, "outputDirectory", project.getAbsolutePath());
mojoRule.setVariableValueToObject(mojo, "compileClasspathElements", Collections.emptyList());
} else if (goal.equals("transform-test")) {
mojoRule.setVariableValueToObject(mojo, "testOutputDirectory", project.getAbsolutePath());
mojoRule.setVariableValueToObject(mojo, "testClasspathElements", Collections.emptyList());
} else {
throw new AssertionError("Unknown goal: " + goal);
}
mojoRule.setVariableValueToObject(mojo, "repositorySystem", repositorySystem);
mojoRule.setVariableValueToObject(mojo, "groupId", FOO);
mojoRule.setVariableValueToObject(mojo, "artifactId", BAR);
mojoRule.setVariableValueToObject(mojo, "version", QUX);
mojo.setLog(new SilentLog());
mojo.execute();
}
use of org.apache.maven.plugin.testing.SilentLog in project kotlin by JetBrains.
the class KotlinCompilationFailureExceptionTest method testLocationNoColumn.
@Test
public void testLocationNoColumn() throws Exception {
MavenPluginLogMessageCollector collector = new MavenPluginLogMessageCollector(new SilentLog());
collector.report(CompilerMessageSeverity.ERROR, "Error in file", CompilerMessageLocation.create("myfile.txt", 777, -1, "nothing"));
try {
collector.throwKotlinCompilerException();
fail();
} catch (KotlinCompilationFailureException e) {
assertEquals("myfile.txt:[777] Error in file", e.getLongMessage().trim());
}
}
use of org.apache.maven.plugin.testing.SilentLog in project kotlin by JetBrains.
the class KotlinCompilationFailureExceptionTest method testLocationNoLineNoColumn.
@Test
public void testLocationNoLineNoColumn() throws Exception {
MavenPluginLogMessageCollector collector = new MavenPluginLogMessageCollector(new SilentLog());
collector.report(CompilerMessageSeverity.ERROR, "Error in file", CompilerMessageLocation.create("myfile.txt", -1, -1, "nothing"));
try {
collector.throwKotlinCompilerException();
fail();
} catch (KotlinCompilationFailureException e) {
assertEquals("myfile.txt: Error in file", e.getLongMessage().trim());
}
}
use of org.apache.maven.plugin.testing.SilentLog in project sling by apache.
the class ValidateMojoTest method getMojo.
private ValidateMojo getMojo(File baseDir, String pomFile) throws Exception {
SilentLog log = new SilentLog();
DefaultBuildContext buildContext = new DefaultBuildContext();
File pom = new File(baseDir, pomFile);
ValidateMojo validateMojo = new ValidateMojo();
mojoRule.configureMojo(validateMojo, mojoRule.extractPluginConfiguration("htl-maven-plugin", pom));
MavenProject mavenProject = new ProjectStub(pom);
mojoRule.setVariableValueToObject(validateMojo, "project", mavenProject);
validateMojo.setLog(log);
buildContext.enableLogging(log);
validateMojo.setBuildContext(buildContext);
return validateMojo;
}
use of org.apache.maven.plugin.testing.SilentLog in project kotlin by JetBrains.
the class KotlinCompilationFailureExceptionTest method testNoLocation.
@Test
public void testNoLocation() throws Exception {
MavenPluginLogMessageCollector collector = new MavenPluginLogMessageCollector(new SilentLog());
collector.report(CompilerMessageSeverity.ERROR, "Something went wrong", CompilerMessageLocation.NO_LOCATION);
try {
collector.throwKotlinCompilerException();
fail();
} catch (KotlinCompilationFailureException e) {
assertEquals("Something went wrong", e.getLongMessage().trim());
}
}
Aggregations