ottlinger commented on code in PR #159:
URL: https://github.com/apache/creadur-rat/pull/159#discussion_r1375315127


##########
apache-rat-plugin/src/test/java/org/apache/rat/mp/BetterAbstractMojoTestCase.java:
##########
@@ -0,0 +1,118 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*
+ * This software is copyright (c) 2015 by Alex Heneveld and Cloudsoft 
Corporation.
+ * 
+ * code lifted from https://github.com/ahgittin/license-audit-maven-plugin
+ */
+package org.apache.rat.mp;
+
+import java.io.File;
+import java.util.Arrays;
+
+import org.apache.maven.DefaultMaven;
+import org.apache.maven.Maven;
+import org.apache.maven.execution.DefaultMavenExecutionRequest;
+import org.apache.maven.execution.DefaultMavenExecutionResult;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionRequestPopulator;
+import org.apache.maven.execution.MavenExecutionResult;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
+import org.eclipse.aether.repository.LocalRepository;
+
+/** Use this as you would {@link AbstractMojoTestCase},
+ * where you want more of the standard maven defaults to be set
+ * (and where the {@link AbstractMojoTestCase} leaves them as null or empty).
+ * This includes:
+ * <li> local repo, repo sessions and managers configured
+ * <li> maven default remote repos installed (NB: this does not use your ~/.m2 
local settings)
+ * <li> system properties are copies
+ * <p>
+ * No changes to subclass code is needed; this simply intercepts the {@link 
#newMavenSession(MavenProject)} method
+ * used by the various {@link #lookupMojo(String, File)} methods.
+ * <p>
+ * This also provides new methods, {@link #newMavenSession()} to conveniently 
create a maven session,
+ * and {@link #lookupConfiguredMojo(File, String)} so you don't have to always 
build the project yourself.
+ */ 
+public abstract class BetterAbstractMojoTestCase extends AbstractMojoTestCase {

Review Comment:
   What do we get from this new base class?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to