Skip to content
Closed
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
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 @@ -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 @@ -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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@
import java.util.HashMap;
import java.util.Map;

import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

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

/**
* @author Alan Parkinson
* @version $Id$
* @since 2.7
*/
public class IssueManagementSystemTest extends TestCase {
public class IssueManagementSystemTest {

private MockIssueManagementSystem ims;

Expand All @@ -41,11 +44,12 @@ public String getName() {
}
}

@Override
protected void setUp() {
@BeforeEach
public void setUp() {
ims = new MockIssueManagementSystem();
}

@Test
public void testApplyingValidCustomIssueTypes() {
Map<String, String> issueTypes = new HashMap<>();
issueTypes.put("add", "Story,Epic");
Expand All @@ -59,6 +63,7 @@ public void testApplyingValidCustomIssueTypes() {
}
}

@Test
public void testApplyingInvalidCustomIssueTypes() {
Map<String, String> issueTypes = new HashMap<>();
issueTypes.put("new", "Story,Epic");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,54 @@
*/
package org.apache.maven.plugins.changes.issues;

import junit.framework.TestCase;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

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

/**
* Tests for the Issue class.
*
* @author Dennis Lundberg
* @version $Id$
*/
public class IssueTestCase extends TestCase {
public class IssueTestCase {
Issue issue;

protected void setUp() {
@BeforeEach
public void setUp() {
issue = new Issue();
}

@Test
public void testGetSetAssignee() {
issue.setAssignee("assignee");

assertEquals("assignee", issue.getAssignee());
}

@Test
public void testGetSetKey() {
issue.setKey("key");

assertEquals("key", issue.getKey());
}

@Test
public void testGetSetResolution() {
issue.setResolution("resolution");

assertEquals("resolution", issue.getResolution());
}

@Test
public void testGetSetStatus() {
issue.setStatus("status");

assertEquals("status", issue.getStatus());
}

@Test
public void testGetSetSummary() {
issue.setSummary("summary");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
import java.util.ArrayList;
import java.util.List;

import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import org.junit.jupiter.api.Test;

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

/**
* Tests for the IssueUtils class.
Expand All @@ -31,7 +34,8 @@
* @version $Id$
* @since 2.4
*/
public class IssueUtilsTestCase extends TestCase {
public class IssueUtilsTestCase {
@Test
public void testFilterIssuesWithVersionPrefix() {
Issue issue1;
issue1 = new Issue();
Expand Down
Loading
Loading