Search in sources :

Example 1 with ReleaseUtils

use of org.apache.maven.plugins.changes.ReleaseUtils 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());
}
Also used : ReleaseUtils(org.apache.maven.plugins.changes.ReleaseUtils) SilentLog(org.apache.maven.plugin.testing.SilentLog) Log(org.apache.maven.plugin.logging.Log) SilentLog(org.apache.maven.plugin.testing.SilentLog) ArrayList(java.util.ArrayList) Release(org.apache.maven.plugins.changes.model.Release)

Aggregations

ArrayList (java.util.ArrayList)1 Log (org.apache.maven.plugin.logging.Log)1 SilentLog (org.apache.maven.plugin.testing.SilentLog)1 ReleaseUtils (org.apache.maven.plugins.changes.ReleaseUtils)1 Release (org.apache.maven.plugins.changes.model.Release)1