Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ under the License.
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -318,14 +322,6 @@ under the License.
<artifactId>rome</artifactId>
<version>2.1.0</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down Expand Up @@ -356,6 +352,11 @@ under the License.
<version>${mavenResolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
12 changes: 9 additions & 3 deletions src/test/java/org/apache/maven/plugins/changes/ActionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,57 @@
package org.apache.maven.plugins.changes;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.maven.plugins.changes.model.Action;

public class ActionTest extends TestCase {
import static org.junit.jupiter.api.Assertions.assertEquals;

public class ActionTest {
Action action = new Action();

public ActionTest(String testName) {
super(testName);
}

public static Test suite() {
return new TestSuite(ActionTest.class);
}

@org.junit.jupiter.api.Test
public void testGetSetAction() {
action.setAction("action");

assertEquals("action", action.getAction());
}

@org.junit.jupiter.api.Test
public void testGetSetDev() {
action.setDev("developer");

assertEquals("developer", action.getDev());
}

@org.junit.jupiter.api.Test
public void testGetSetType() {
action.setType("type");

assertEquals("type", action.getType());
}

@org.junit.jupiter.api.Test
public void testGetSetIssue() {
action.setIssue("issue");

assertEquals("issue", action.getIssue());
}

@org.junit.jupiter.api.Test
public void testGetSetDueTo() {
action.setDueTo("due-to");

assertEquals("due-to", action.getDueTo());
}

@org.junit.jupiter.api.Test
public void testGetSetDueToEmail() {
action.setDueToEmail("due-to-mail");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
*/
package org.apache.maven.plugins.changes;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

/**
* @author Dennis Lundberg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.fail;

/**
* @author Olivier Lamy
Expand All @@ -32,12 +36,14 @@ public class ChangesValidatorMojoTest extends AbstractMojoTestCase {

protected ChangesValidatorMojo mojo;

@BeforeEach
public void setUp() throws Exception {
super.setUp();
File pom = new File(getBasedir(), "/src/test/unit/plugin-config.xml");
mojo = lookupMojo("changes-validate", pom);
}

@Test
public void testValidationSuccess() throws Exception {
File changesXml = new File(getBasedir(), "/src/test/unit/changes.xml");
setVariableValueToObject(mojo, "xmlPath", changesXml);
Expand All @@ -46,6 +52,7 @@ public void testValidationSuccess() throws Exception {
mojo.execute();
}

@Test
public void testValidationFailedWithMojoFailure() throws Exception {
File changesXml = new File(getBasedir(), "/src/test/unit/non-valid-changes.xml");
setVariableValueToObject(mojo, "xmlPath", changesXml);
Expand All @@ -59,6 +66,7 @@ public void testValidationFailedWithMojoFailure() throws Exception {
}
}

@Test
public void testValidationFailedWithNoMojoFailure() throws Exception {
File changesXml = new File(getBasedir(), "/src/test/unit/non-valid-changes.xml");
setVariableValueToObject(mojo, "xmlPath", changesXml);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
import org.apache.maven.plugin.testing.SilentLog;
import org.apache.maven.plugins.changes.model.Action;
import org.apache.maven.plugins.changes.model.Release;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;

/**
* @author Olivier Lamy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,35 @@
import java.util.List;
import java.util.Locale;

import junit.framework.TestCase;
import org.apache.maven.plugins.changes.model.Release;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

/**
* @author ltheussl
*/
public class FeedGeneratorTest extends TestCase {
public class FeedGeneratorTest {
/**
* Test of isSupportedFeedType method, of class FeedGenerator.
*/
@Test
public void testIsSupportedFeedType() {
final FeedGenerator generator = new FeedGenerator(Locale.ENGLISH);

assertTrue("rss_0.9 not supported?", generator.isSupportedFeedType("rss_0.9"));
assertTrue("rss_0.91N not supported?", generator.isSupportedFeedType("rss_0.91N"));
assertTrue("rss_0.91U not supported?", generator.isSupportedFeedType("rss_0.91U"));
assertTrue("rss_0.92 not supported?", generator.isSupportedFeedType("rss_0.92"));
assertTrue("rss_0.93 not supported?", generator.isSupportedFeedType("rss_0.93"));
assertTrue("rss_0.94 not supported?", generator.isSupportedFeedType("rss_0.94"));
assertTrue("rss_1.0 not supported?", generator.isSupportedFeedType("rss_1.0"));
assertTrue("rss_2.0 not supported?", generator.isSupportedFeedType("rss_2.0"));
assertTrue("atom_0.3 not supported?", generator.isSupportedFeedType("atom_0.3"));
assertTrue("atom_1.0 not supported?", generator.isSupportedFeedType("atom_1.0"));
assertTrue(generator.isSupportedFeedType("rss_0.9"), "rss_0.9 not supported?");
assertTrue(generator.isSupportedFeedType("rss_0.91N"), "rss_0.91N not supported?");
assertTrue(generator.isSupportedFeedType("rss_0.91U"), "rss_0.91U not supported?");
assertTrue(generator.isSupportedFeedType("rss_0.92"), "rss_0.92 not supported?");
assertTrue(generator.isSupportedFeedType("rss_0.93"), "rss_0.93 not supported?");
assertTrue(generator.isSupportedFeedType("rss_0.94"), "rss_0.94 not supported?");
assertTrue(generator.isSupportedFeedType("rss_1.0"), "rss_1.0 not supported?");
assertTrue(generator.isSupportedFeedType("rss_2.0"), "rss_2.0 not supported?");
assertTrue(generator.isSupportedFeedType("atom_0.3"), "atom_0.3 not supported?");
assertTrue(generator.isSupportedFeedType("atom_1.0"), "atom_1.0 not supported?");

assertFalse(generator.isSupportedFeedType(""));
assertFalse(generator.isSupportedFeedType(null));
Expand All @@ -59,6 +65,7 @@ public void testIsSupportedFeedType() {
*
* @throws Exception if any.
*/
@Test
public void testExport() throws Exception {
final FeedGenerator generator = new FeedGenerator(Locale.ENGLISH);
generator.setAuthor("author");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@
import java.util.Arrays;
import java.util.List;

import junit.framework.TestCase;
import org.apache.maven.plugins.changes.issues.Issue;
import org.apache.maven.plugins.changes.issues.IssueManagementSystem;
import org.apache.maven.plugins.changes.jira.JIRAIssueManagementSystem;
import org.apache.maven.plugins.changes.model.Action;
import org.apache.maven.plugins.changes.model.Release;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Alan Parkinson
* @version $Id$
* @since 2.6
*/
public class IssueAdapterTest extends TestCase {
public class IssueAdapterTest {

@Test
public void testDefaultIssueTypeMapping() {
IssueAdapter adapter = new IssueAdapter(new JIRAIssueManagementSystem());

Expand Down Expand Up @@ -67,6 +70,7 @@ public void testDefaultIssueTypeMapping() {
assertEquals("", action.getType());
}

@Test
public void testCustomIssueTypeMappingOveridesDefaultMapping() {
IssueManagementSystem ims = new JIRAIssueManagementSystem();

Expand All @@ -90,6 +94,7 @@ public void testCustomIssueTypeMappingOveridesDefaultMapping() {
assertEquals("", action.getType());
}

@Test
public void testCustomIssueTypeMapping() {
IssueManagementSystem ims = new JIRAIssueManagementSystem();
ims.getIssueTypeMap().put("Story", IssueType.ADD);
Expand Down Expand Up @@ -137,6 +142,7 @@ private Issue createIssue(String key, String type, String version) {
return issue;
}

@Test
public void testReleaseOrder() {
IssueManagementSystem ims = new JIRAIssueManagementSystem();
ims.getIssueTypeMap().put("Story", IssueType.ADD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,37 @@
import java.util.List;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.maven.plugins.changes.model.Action;
import org.apache.maven.plugins.changes.model.Release;

public class ReleaseTest extends TestCase {
import static org.junit.jupiter.api.Assertions.assertEquals;

public class ReleaseTest {
Release release = new Release();

public ReleaseTest(String testName) {
super(testName);
}

public static Test suite() {
return new TestSuite(ReleaseTest.class);
}

@org.junit.jupiter.api.Test
public void testGetSetVersion() {
release.setVersion("version");

assertEquals("version", release.getVersion());
}

@org.junit.jupiter.api.Test
public void testGetSetDateRelease() {
release.setDateRelease("12-09-1979");

assertEquals("12-09-1979", release.getDateRelease());
}

@org.junit.jupiter.api.Test
public void testGetSetAction() {
List<Action> actionList = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import java.util.List;

import org.apache.maven.plugins.changes.model.Release;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Dennis Lundberg
Expand All @@ -41,37 +41,37 @@ public void testMergeReleases() {
List<Release> mergedReleases;

mergedReleases = ReleaseUtils.mergeReleases(firstReleases, secondReleases);
assertEquals("Both empty", 0, mergedReleases.size());
assertEquals(0, mergedReleases.size(), "Both empty");

Release release = new Release();
release.setVersion("1.0");
firstReleases.add(release);

mergedReleases = ReleaseUtils.mergeReleases(firstReleases, secondReleases);
assertEquals("One release in first", 1, mergedReleases.size());
assertEquals(1, mergedReleases.size(), "One release in first");

release = new Release();
release.setVersion("1.1");
secondReleases.add(release);

mergedReleases = ReleaseUtils.mergeReleases(firstReleases, secondReleases);
assertEquals("One release each", 2, mergedReleases.size());
assertEquals(2, mergedReleases.size(), "One release each");

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());
mergedReleases.size(),
"Two releases in first, one release in second with one version being the same");

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());
assertEquals(3, mergedReleases.size(), "Two releases each with one version being the same");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@

import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Olivier Lamy
* @version $Id$
*/
public class AnnouncementMojoTest extends AbstractMojoTestCase {

@Test
public void testAnnounceGeneration() throws Exception {
File pom = new File(getBasedir(), "/src/test/unit/plugin-config.xml");
AnnouncementMojo mojo = lookupMojo("announcement-generate", pom);
Expand Down
Loading
Loading