mirror of https://github.com/apache/maven.git
[MNG-4904] Make MavenExecutionResult.getTopologicallySortedProjects() return empty list instead of null
Submitted by: Basil James Whitehouse III git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1036585 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
381f2ac253
commit
0bfec136db
|
@ -63,7 +63,7 @@ public class DefaultMavenExecutionResult
|
|||
|
||||
public List<MavenProject> getTopologicallySortedProjects()
|
||||
{
|
||||
return topologicallySortedProjects;
|
||||
return null == topologicallySortedProjects ? Collections.<MavenProject> emptyList() : topologicallySortedProjects;
|
||||
}
|
||||
|
||||
public DependencyResolutionResult getDependencyResolutionResult()
|
||||
|
|
|
@ -33,6 +33,10 @@ public interface MavenExecutionResult
|
|||
MavenProject getProject();
|
||||
|
||||
MavenExecutionResult setTopologicallySortedProjects( List<MavenProject> projects );
|
||||
|
||||
/**
|
||||
* @return the sorted list, or an empty list if there are no projects.
|
||||
*/
|
||||
List<MavenProject> getTopologicallySortedProjects();
|
||||
|
||||
MavenExecutionResult setDependencyResolutionResult( DependencyResolutionResult result );
|
||||
|
|
|
@ -19,6 +19,10 @@ package org.apache.maven.execution;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
|
@ -36,4 +40,13 @@ public class DefaultMavenExecutionTest
|
|||
assertNotSame( copy, original );
|
||||
}
|
||||
|
||||
public void testResultWithNullTopologicallySortedProjectsIsEmptyList()
|
||||
{
|
||||
MavenExecutionResult result = new DefaultMavenExecutionResult();
|
||||
result.setTopologicallySortedProjects( null );
|
||||
List<MavenProject> projects = result.getTopologicallySortedProjects();
|
||||
assertNotNull( projects );
|
||||
assertTrue( projects.isEmpty() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue