summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Chouinard2013-03-20 22:26:41 (EDT)
committerSebastien Dubois2013-03-20 22:26:41 (EDT)
commit9c68262fec207fd96ca24d20480e5f04f2ce51ef (patch)
tree565e2baa4d226c9e96e5f9cd22ec5189c4e78424
parentf31c4d450c6d77f6b9dcdcdebaf768402bf3d2c6 (diff)
downloadorg.eclipse.mylyn.reviews.r4e-9c68262fec207fd96ca24d20480e5f04f2ce51ef.zip
org.eclipse.mylyn.reviews.r4e-9c68262fec207fd96ca24d20480e5f04f2ce51ef.tar.gz
org.eclipse.mylyn.reviews.r4e-9c68262fec207fd96ca24d20480e5f04f2ce51ef.tar.bz2
R4E UI JUnit improvementsrefs/changes/74/11374/1
- Introduce an R4EAssert class that wraps JUnit's Assert - Add an identifying message to the assert statements - Make some rogue internal test methods 'private' - Add some comments in test cases - Re-organize the TestUtils class in logical sections - Ensure that the projects and the shared data are effectively cleared at the start of each test suite (cleanup leftovers) Notes: - This is just preliminary work for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=399549 - R4EAssert introduces a delay on each call to assertXXX. There is room for optimization there. On the other hand, the extra delay seemed to stabilize the tests on my machine... - Reviewers: pay special attention on the construction of the R4EAssert objects: the String parameter should match the method name otherwise it could be very misleading. - Fixed a bunch of anomalies. Change-Id: I41b55f7f07337e6d57690970bf9c14c2984f9a8b Conflicts: org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithSrangeCharTest.java org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java org.eclipse.mylyn.reviews.r4e.upgrade/pom.xml
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java6
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java24
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java442
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java383
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java613
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java106
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithStrangeCharTest.java (renamed from org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithSrangeCharTest.java)81
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java363
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestAnomaly.java3
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestItem.java2
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestRule.java1
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java442
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java486
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java325
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/R4EAssert.java90
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java237
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java6
17 files changed, 2275 insertions, 1335 deletions
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java
index f4dd8f9..b2a7198 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java
@@ -24,7 +24,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.tests.feature.CloneAnomaliesCommentsTest
import org.eclipse.mylyn.reviews.r4e.ui.tests.feature.DuplicateAnomalyTests;
import org.eclipse.mylyn.reviews.r4e.ui.tests.feature.PostponedAnomaliesTests;
import org.eclipse.mylyn.reviews.r4e.ui.tests.feature.PreferencesTests;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.feature.ReviewWithSrangeCharTest;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.feature.ReviewWithStrangeCharTest;
import org.eclipse.mylyn.reviews.r4e.ui.tests.feature.UserReviewedTests;
import org.eclipse.mylyn.reviews.r4e.ui.tests.sanity.SanityBasicTests;
import org.eclipse.mylyn.reviews.r4e.ui.tests.sanity.SanityInformalTests;
@@ -54,7 +54,7 @@ public class R4EUIAllTests extends TestSuite {
public static Test suite() {
//Execute test cases
- TestSuite suite = new R4EUIAllTests("R4E Core Tests");
+ TestSuite suite = new R4EUIAllTests("R4E UI Tests"); //$NON-NLS-1$
suite.addTestSuite(SanitySetupTests.class);
suite.addTestSuite(SanityBasicTests.class);
suite.addTestSuite(SanityInformalTests.class);
@@ -63,7 +63,7 @@ public class R4EUIAllTests extends TestSuite {
suite.addTestSuite(PostponedAnomaliesTests.class);
suite.addTestSuite(CloneAnomaliesCommentsTests.class);
suite.addTestSuite(DuplicateAnomalyTests.class);
- suite.addTestSuite(ReviewWithSrangeCharTest.class);
+ suite.addTestSuite(ReviewWithStrangeCharTest.class);
//TODO Add test cases here
//suite.addTestSuite(ReviewGroupTests.class);
//suite.addTestSuite(ReviewTests.class);
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java
index c6924f7..8279aad 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java
@@ -11,12 +11,12 @@
*/
package org.eclipse.mylyn.reviews.r4e.ui.tests;
-import junit.framework.Assert;
+import java.util.concurrent.ExecutionException;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.commands.common.NotDefinedException;
@@ -26,6 +26,7 @@ import org.eclipse.mylyn.reviews.r4e.core.model.serial.impl.ResourceHandlingExce
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRuleSet;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
import org.eclipse.mylyn.reviews.r4e.ui.tests.sanity.SanitySetupTests;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
import org.junit.Before;
@@ -33,7 +34,7 @@ import org.junit.Before;
/**
* @author Sebastien Dubois
*/
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class RuleSetTests extends TestCase {
// ------------------------------------------------------------------------
@@ -66,8 +67,8 @@ public class RuleSetTests extends TestCase {
/**
* Sets up the fixture, for example, open a network connection. This method is called before a test is executed.
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
TestUtils.startNavigatorView();
}
@@ -75,8 +76,8 @@ public class RuleSetTests extends TestCase {
/**
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fRuleSet = null;
TestUtils.stopNavigatorView();
@@ -95,17 +96,22 @@ public class RuleSetTests extends TestCase {
public void testNewRuleSet() throws ResourceHandlingException, OutOfSyncException, ExecutionException,
NotDefinedException, NotEnabledException, NotHandledException {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("testNewRuleSet");
+
//Create a Rule Set
+ r4eAssert.setTest("Create a Rule Set");
R4EUITestMain proxy = R4EUITestMain.getInstance();
fRuleSet = proxy.getRuleSetProxy().createRuleSet(TestUtils.FSharedFolder, RULE_SET_TEST_NAME,
RULE_SET_TEST_VERSION);
- Assert.assertNotNull(fRuleSet);
- Assert.assertEquals(RULE_SET_TEST_VERSION, fRuleSet.getRuleSet().getVersion());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString(), fRuleSet.getRuleSet().getFolder());
- Assert.assertEquals(RULE_SET_TEST_NAME, fRuleSet.getRuleSet().getName());
+ r4eAssert.assertNotNull(fRuleSet);
+ r4eAssert.assertEquals(RULE_SET_TEST_VERSION, fRuleSet.getRuleSet().getVersion());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString(), fRuleSet.getRuleSet().getFolder());
+ r4eAssert.assertEquals(RULE_SET_TEST_NAME, fRuleSet.getRuleSet().getName());
}
+
/**
* Open Rule Set
*
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java
index 4a97a87..9f0116b 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java
@@ -12,7 +12,7 @@
*
* Contributors:
* Sebastien Dubois - Created for Mylyn Review R4E project
- *
+ * Francois Chouinard - Add identifying message to each assert
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.feature;
@@ -21,7 +21,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -50,12 +49,13 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorAction
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
import org.junit.Before;
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class CloneAnomaliesCommentsTests extends TestCase {
// ------------------------------------------------------------------------
@@ -118,12 +118,13 @@ public class CloneAnomaliesCommentsTests extends TestCase {
private R4EUIAnomalyBasic fClonedAnomaly2 = null;
+ @SuppressWarnings("unused")
private final R4EUIAnomalyBasic fClonedAnomaly3 = null;
private R4EUIAnomalyBasic fClonedAnomaly4 = null;
// ------------------------------------------------------------------------
- // Methods
+ // Housekeeping
// ------------------------------------------------------------------------
/**
@@ -143,8 +144,8 @@ public class CloneAnomaliesCommentsTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
fProxy = R4EUITestMain.getInstance();
createReviewGroups();
@@ -163,14 +164,18 @@ public class CloneAnomaliesCommentsTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fProxy = null;
}
+ // ------------------------------------------------------------------------
+ // Main test case
+ // ------------------------------------------------------------------------
+
/**
- * Method testBasicReviews
+ * Method testCloning
*
* @throws CoreException
*/
@@ -184,14 +189,22 @@ public class CloneAnomaliesCommentsTests extends TestCase {
cloneCommentsCopyPaste();
}
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroups
*/
private void createReviewGroups() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewGroups");
+
fGroup = null;
- //Create Review Group
+ // Create Review Group
+ r4eAssert.setTest("Create Review Group");
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(TestConstants.REVIEW_GROUP_TEST_NAME)) {
fGroup = group;
@@ -205,20 +218,21 @@ public class CloneAnomaliesCommentsTests extends TestCase {
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
- Assert.assertNotNull(fGroup);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertNotNull(fGroup);
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup().getDescription());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
+ .getDescription());
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
.getDefaultEntryCriteria());
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
.getAvailableProjects()
.get(i));
}
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
.getAvailableComponents()
.get(i));
}
@@ -227,10 +241,15 @@ public class CloneAnomaliesCommentsTests extends TestCase {
}
/**
- * Method createOriginalReview
+ * Method createReviewItem
*/
private void createReview() {
- //Update Review Group handle
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReview");
+
+ // Update Review Group handle
+ r4eAssert.setTest("Update Review Group Handle");
for (IR4EUIModelElement elem : R4EUIModelController.getRootElement().getChildren()) {
if (fGroupName.equals(elem.getName())) {
fGroup = (R4EUIReviewGroup) elem;
@@ -239,184 +258,190 @@ public class CloneAnomaliesCommentsTests extends TestCase {
if (!fGroup.isOpen()) {
fProxy.getCommandProxy().openElement(fGroup);
}
- Assert.assertTrue(fGroup.isOpen());
+ r4eAssert.assertTrue(fGroup.isOpen());
+ r4eAssert.setTest("Create Review");
fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
REVIEW_TEST_NAME, REVIEW_TEST_DESCRIPTION, TestConstants.REVIEW_TEST_DUE_DATE,
TestConstants.REVIEW_TEST_PROJECT, TestConstants.REVIEW_TEST_COMPONENTS,
TestConstants.REVIEW_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_TEST_OBJECTIVES,
TestConstants.REVIEW_TEST_REFERENCE_MATERIALS);
- Assert.assertNotNull(fReview);
- Assert.assertNotNull(fReview.getParticipantContainer());
- Assert.assertNotNull(fReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
- Assert.assertEquals(REVIEW_TEST_NAME, fReview.getReview().getName());
- Assert.assertEquals(REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
- Assert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
+ r4eAssert.assertNotNull(fReview);
+ r4eAssert.assertNotNull(fReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
+ r4eAssert.assertEquals(REVIEW_TEST_NAME, fReview.getReview().getName());
+ r4eAssert.assertEquals(REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
for (int i = 0; i < TestConstants.REVIEW_TEST_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
}
- Assert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
- Assert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
- Assert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview().getReferenceMaterial());
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview()
+ .getReferenceMaterial());
+ r4eAssert.assertTrue(fReview.isOpen());
}
/**
- * Method createOriginalReviewItem
+ * Method createReviewItem
*/
private void createReviewItem() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewItem");
+
+ r4eAssert.setTest("Create Commit Item");
fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
- Assert.assertNotNull(fItem);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
- Assert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
- Assert.assertEquals("second Java Commit", fItem.getItem().getDescription());
- Assert.assertEquals(4, fItem.getChildren().length);
+ r4eAssert.assertNotNull(fItem);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
+ r4eAssert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
+ r4eAssert.assertEquals("second Java Commit", fItem.getItem().getDescription());
+ r4eAssert.assertEquals(4, fItem.getChildren().length);
for (int i = 0; i < fItem.getChildren().length; i++) {
if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
fAnomalyFileIndex = i; //Used later to add anomalies
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
- Assert.assertEquals(606, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(606, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(25,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(0)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertEquals(665, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(25, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(0)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertEquals(665, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(63,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(1)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertEquals(733, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(63, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(1)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertEquals(733, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(2)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(61,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(2)
- .getTarget()
- .getLocation()).getLength());
- //Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertEquals(61, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(2)
+ .getTarget()
+ .getLocation()).getLength());
+ //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
// ((R4EUIFileContext) fItem.getChildren()[i]).getContentsContainerElement().getChildren(), true,
// R4EUIConstants.DELTA_ANNOTATION_ID));
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE4_PROJ_NAME)) {
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE3_PROJ_NAME)) {
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE2_PROJ_NAME)) {
- Assert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getTarget());
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getTarget());
}
}
+ r4eAssert.setTest("Create Manual Tree Item");
fItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
- Assert.assertNotNull(fItem2);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
+ r4eAssert.assertNotNull(fItem2);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(0, ((R4ETextPosition) fItem2.getItem()
+ r4eAssert.assertEquals(0, ((R4ETextPosition) fItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(755, ((R4ETextPosition) fItem2.getItem()
+ r4eAssert.assertEquals(755, ((R4ETextPosition) fItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.setTest("Create Manual Text Item");
fItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
- Assert.assertNotNull(fItem3);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
+ r4eAssert.assertNotNull(fItem3);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(50, ((R4ETextPosition) fItem3.getItem()
+ r4eAssert.assertEquals(50, ((R4ETextPosition) fItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(20, ((R4ETextPosition) fItem3.getItem()
+ r4eAssert.assertEquals(20, ((R4ETextPosition) fItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
R4EUIConstants.SELECTION_ANNOTATION_ID));
}
@@ -427,6 +452,11 @@ public class CloneAnomaliesCommentsTests extends TestCase {
* @param aReview
*/
private void createParticipants(R4EUIReviewBasic aReview) {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createParticipants");
+
+ r4eAssert.setTest("Create Participant");
List<R4EParticipant> participants = new ArrayList<R4EParticipant>(1);
R4EParticipant participant = RModelFactory.eINSTANCE.createR4EParticipant();
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
@@ -434,17 +464,22 @@ public class CloneAnomaliesCommentsTests extends TestCase {
participants.add(participant);
R4EUIParticipant uiParticipant = fProxy.getParticipantProxy().createParticipant(
aReview.getParticipantContainer(), participants);
- Assert.assertNotNull(uiParticipant);
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, uiParticipant.getParticipant().getId());
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, uiParticipant.getParticipant().getEmail());
- Assert.assertEquals(R4EUserRole.R4E_ROLE_REVIEWER, uiParticipant.getParticipant().getRoles().get(0));
+ r4eAssert.assertNotNull(uiParticipant);
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, uiParticipant.getParticipant().getId());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, uiParticipant.getParticipant().getEmail());
+ r4eAssert.assertEquals(R4EUserRole.R4E_ROLE_REVIEWER, uiParticipant.getParticipant().getRoles().get(0));
}
/**
* Method createAnomalies
*/
private void createAnomalies() {
- //Anomaly1
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createAnomalies");
+
+ // Anomaly1
+ r4eAssert.setTest("Anomaly 1");
R4EUIContent content1 = fItem.getFileContexts()
.get(fAnomalyFileIndex)
.getContentsContainerElement()
@@ -454,22 +489,23 @@ public class CloneAnomaliesCommentsTests extends TestCase {
ANOMALY1_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fAnomaly1);
- Assert.assertEquals(ANOMALY1_TEST_TITLE, fAnomaly1.getAnomaly().getTitle());
- Assert.assertEquals(ANOMALY1_TEST_DESCRIPTION, fAnomaly1.getAnomaly().getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, ((R4ECommentType) fAnomaly1.getAnomaly()
+ r4eAssert.assertNotNull(fAnomaly1);
+ r4eAssert.assertEquals(ANOMALY1_TEST_TITLE, fAnomaly1.getAnomaly().getTitle());
+ r4eAssert.assertEquals(ANOMALY1_TEST_DESCRIPTION, fAnomaly1.getAnomaly().getDescription());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, ((R4ECommentType) fAnomaly1.getAnomaly()
.getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fAnomaly1.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fAnomaly1.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fAnomaly1.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fAnomaly1.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fAnomaly1.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fAnomaly1.getAnomaly().getAssignedTo().get(0));
+ r4eAssert.assertEquals(
((R4EUITextPosition) content1.getPosition()).getOffset(),
((R4ETextPosition) ((R4ETextContent) fAnomaly1.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4EUITextPosition) content1.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fAnomaly1.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- //Anomaly2
+ // Anomaly2
+ r4eAssert.setTest("Anomaly 2");
R4EUIContent content2 = fItem.getFileContexts()
.get(fAnomalyFileIndex)
.getContentsContainerElement()
@@ -479,22 +515,22 @@ public class CloneAnomaliesCommentsTests extends TestCase {
ANOMALY2_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fAnomaly2);
- Assert.assertEquals(ANOMALY2_TEST_TITLE, fAnomaly2.getAnomaly().getTitle());
- Assert.assertEquals(ANOMALY2_TEST_DESCRIPTION, fAnomaly2.getAnomaly().getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, ((R4ECommentType) fAnomaly2.getAnomaly()
+ r4eAssert.assertNotNull(fAnomaly2);
+ r4eAssert.assertEquals(ANOMALY2_TEST_TITLE, fAnomaly2.getAnomaly().getTitle());
+ r4eAssert.assertEquals(ANOMALY2_TEST_DESCRIPTION, fAnomaly2.getAnomaly().getDescription());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, ((R4ECommentType) fAnomaly2.getAnomaly()
.getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fAnomaly2.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fAnomaly2.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fAnomaly2.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fAnomaly2.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fAnomaly2.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fAnomaly2.getAnomaly().getAssignedTo().get(0));
+ r4eAssert.assertEquals(
((R4EUITextPosition) content2.getPosition()).getOffset(),
((R4ETextPosition) ((R4ETextContent) fAnomaly2.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4EUITextPosition) content2.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fAnomaly2.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(fAnomaly2.getParent().getChildren(), true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(fAnomaly2.getParent().getChildren(), true,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
@@ -502,77 +538,112 @@ public class CloneAnomaliesCommentsTests extends TestCase {
* Method createComments
*/
private void createComments() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createComments");
+
+ r4eAssert.setTest("Anomaly 1 Comment 1");
fAnomaly1Comment1 = fProxy.getCommentProxy().createComment(fAnomaly1, ANOMALY1_COMMENT1_TEST);
- Assert.assertNotNull(fAnomaly1Comment1);
- Assert.assertEquals(ANOMALY1_COMMENT1_TEST, fAnomaly1Comment1.getComment().getDescription());
+ r4eAssert.assertNotNull(fAnomaly1Comment1);
+ r4eAssert.assertEquals(ANOMALY1_COMMENT1_TEST, fAnomaly1Comment1.getComment().getDescription());
+ r4eAssert.setTest("Anomaly 1 Comment 2");
fAnomaly1Comment2 = fProxy.getCommentProxy().createComment(fAnomaly1, ANOMALY1_COMMENT2_TEST);
- Assert.assertNotNull(fAnomaly1Comment2);
- Assert.assertEquals(ANOMALY1_COMMENT2_TEST, fAnomaly1Comment2.getComment().getDescription());
+ r4eAssert.assertNotNull(fAnomaly1Comment2);
+ r4eAssert.assertEquals(ANOMALY1_COMMENT2_TEST, fAnomaly1Comment2.getComment().getDescription());
+ r4eAssert.setTest("Anomaly 2 Comment 1");
fAnomaly2Comment1 = fProxy.getCommentProxy().createComment(fAnomaly2, ANOMALY2_COMMENT1_TEST);
- Assert.assertNotNull(fAnomaly2Comment1);
- Assert.assertEquals(ANOMALY2_COMMENT1_TEST, fAnomaly2Comment1.getComment().getDescription());
+ r4eAssert.assertNotNull(fAnomaly2Comment1);
+ r4eAssert.assertEquals(ANOMALY2_COMMENT1_TEST, fAnomaly2Comment1.getComment().getDescription());
+ r4eAssert.setTest("Anomaly 2 Comment 2");
fAnomaly2Comment2 = fProxy.getCommentProxy().createComment(fAnomaly2, ANOMALY2_COMMENT2_TEST);
- Assert.assertNotNull(fAnomaly2Comment2);
- Assert.assertEquals(ANOMALY2_COMMENT2_TEST, fAnomaly2Comment2.getComment().getDescription());
+ r4eAssert.assertNotNull(fAnomaly2Comment2);
+ r4eAssert.assertEquals(ANOMALY2_COMMENT2_TEST, fAnomaly2Comment2.getComment().getDescription());
}
+ // ------------------------------------------------------------------------
+ // Create Anomalies from Editor
+ // ------------------------------------------------------------------------
+
/**
* Method cloneAnomaliesFromEditor
*/
private void cloneAnomaliesFromEditor() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("cloneAnomaliesFromEditor");
+
+ r4eAssert.setTest("Clone Anomaly");
fClonedAnomaly1 = fProxy.getAnomalyProxy().cloneEditorAnomaly(fItem.getFileContexts().get(fAnomalyFileIndex),
20, 50, fAnomaly1, TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_TEST_ID);
- Assert.assertNotNull(fClonedAnomaly1);
- Assert.assertEquals(fAnomaly1.getAnomaly().getTitle(), fClonedAnomaly1.getAnomaly().getTitle());
- Assert.assertEquals(fAnomaly1.getAnomaly().getDescription(), fClonedAnomaly1.getAnomaly().getDescription());
- Assert.assertEquals(((R4ECommentType) fAnomaly1.getAnomaly().getType()).getType(),
+ r4eAssert.assertNotNull(fClonedAnomaly1);
+ r4eAssert.assertEquals(fAnomaly1.getAnomaly().getTitle(), fClonedAnomaly1.getAnomaly().getTitle());
+ r4eAssert.assertEquals(fAnomaly1.getAnomaly().getDescription(), fClonedAnomaly1.getAnomaly().getDescription());
+ r4eAssert.assertEquals(((R4ECommentType) fAnomaly1.getAnomaly().getType()).getType(),
((R4ECommentType) fClonedAnomaly1.getAnomaly().getType()).getType());
- Assert.assertEquals(fAnomaly1.getAnomaly().getRank(), fClonedAnomaly1.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fClonedAnomaly1.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fClonedAnomaly1.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
+ r4eAssert.assertEquals(fAnomaly1.getAnomaly().getRank(), fClonedAnomaly1.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fClonedAnomaly1.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fClonedAnomaly1.getAnomaly().getAssignedTo().get(0));
+ r4eAssert.assertEquals(
20,
((R4ETextPosition) ((R4ETextContent) fClonedAnomaly1.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
50,
((R4ETextPosition) ((R4ETextContent) fClonedAnomaly1.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fClonedAnomaly1, true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fClonedAnomaly1, true,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create Anomalies from External
+ // ------------------------------------------------------------------------
+
/**
* Method cloneAnomaliesFromExternal
*/
private void cloneAnomaliesFromExternal() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("cloneAnomaliesFromExternal");
+
+ r4eAssert.setTest("Clone Anomaly");
fClonedAnomaly2 = fProxy.getAnomalyProxy().cloneExternalAnomaly(TestUtils.FJavaFile3, fAnomaly2,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_TEST_ID);
- Assert.assertNotNull(fClonedAnomaly2);
- Assert.assertEquals(fAnomaly2.getAnomaly().getTitle(), fClonedAnomaly2.getAnomaly().getTitle());
- Assert.assertEquals(fAnomaly2.getAnomaly().getDescription(), fClonedAnomaly2.getAnomaly().getDescription());
- Assert.assertEquals(((R4ECommentType) fAnomaly2.getAnomaly().getType()).getType(),
+ r4eAssert.assertNotNull(fClonedAnomaly2);
+ r4eAssert.assertEquals(fAnomaly2.getAnomaly().getTitle(), fClonedAnomaly2.getAnomaly().getTitle());
+ r4eAssert.assertEquals(fAnomaly2.getAnomaly().getDescription(), fClonedAnomaly2.getAnomaly().getDescription());
+ r4eAssert.assertEquals(((R4ECommentType) fAnomaly2.getAnomaly().getType()).getType(),
((R4ECommentType) fClonedAnomaly2.getAnomaly().getType()).getType());
- Assert.assertEquals(fAnomaly2.getAnomaly().getRank(), fClonedAnomaly2.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fClonedAnomaly2.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fClonedAnomaly2.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
- 0,
- ((R4ETextPosition) ((R4ETextContent) fClonedAnomaly2.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
- 755,
- ((R4ETextPosition) ((R4ETextContent) fClonedAnomaly2.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fClonedAnomaly2, false,
+ r4eAssert.assertEquals(fAnomaly2.getAnomaly().getRank(), fClonedAnomaly2.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fClonedAnomaly2.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fClonedAnomaly2.getAnomaly().getAssignedTo().get(0));
+ r4eAssert.assertEquals(0, ((R4ETextPosition) ((R4ETextContent) fClonedAnomaly2.getAnomaly()
+ .getLocation()
+ .get(0)).getLocation()).getStartPosition());
+ r4eAssert.assertEquals(755, ((R4ETextPosition) ((R4ETextContent) fClonedAnomaly2.getAnomaly()
+ .getLocation()
+ .get(0)).getLocation()).getLength());
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fClonedAnomaly2, false,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create Anomalies from DragDrop
+ // ------------------------------------------------------------------------
+
/**
* Method cloneAnomaliesDragDrop
*/
private void cloneAnomaliesDragDrop() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("cloneAnomaliesDragDrop");
+
+ r4eAssert.setTest("Drag and Drop");
/* TODO drag & drop does not work
List<IR4EUIModelElement> elementsCopied = new ArrayList<IR4EUIModelElement>();
elementsCopied.add(fAnomaly1);
@@ -584,27 +655,36 @@ public class CloneAnomaliesCommentsTests extends TestCase {
targetContent);
fClonedAnomaly3 = (R4EUIAnomalyBasic) elementsDropped.get(0);
- Assert.assertNotNull(fClonedAnomaly3);
- Assert.assertEquals(fAnomaly1.getAnomaly().getTitle(), fClonedAnomaly3.getAnomaly().getTitle());
- Assert.assertEquals(fAnomaly1.getAnomaly().getDescription(), fClonedAnomaly3.getAnomaly().getDescription());
- Assert.assertEquals(((R4ECommentType) fAnomaly1.getAnomaly().getType()).getType(),
+ r4eAssert.assertNotNull(fClonedAnomaly3);
+ r4eAssert.assertEquals(fAnomaly1.getAnomaly().getTitle(), fClonedAnomaly3.getAnomaly().getTitle());
+ r4eAssert.assertEquals(fAnomaly1.getAnomaly().getDescription(), fClonedAnomaly3.getAnomaly().getDescription());
+ r4eAssert.assertEquals(((R4ECommentType) fAnomaly1.getAnomaly().getType()).getType(),
((R4ECommentType) fClonedAnomaly3.getAnomaly().getType()).getType());
- Assert.assertEquals(fAnomaly1.getAnomaly().getRank(), fClonedAnomaly3.getAnomaly().getRank());
- Assert.assertEquals(null, fClonedAnomaly3.getAnomaly().getDueDate());
- Assert.assertEquals(0, fClonedAnomaly3.getAnomaly().getAssignedTo().size());
- Assert.assertEquals(
+ r4eAssert.assertEquals(fAnomaly1.getAnomaly().getRank(), fClonedAnomaly3.getAnomaly().getRank());
+ r4eAssert.assertEquals(null, fClonedAnomaly3.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(0, fClonedAnomaly3.getAnomaly().getAssignedTo().size());
+ r4eAssert.assertEquals(
((R4ETextPosition) targetContent.getContent().getTarget().getLocation()).getStartPosition(),
((R4ETextPosition) ((R4ETextContent) fClonedAnomaly3.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4ETextPosition) targetContent.getContent().getTarget().getLocation()).getLength(),
((R4ETextPosition) ((R4ETextContent) fClonedAnomaly3.getAnomaly().getLocation().get(0)).getLocation()).getLength());
*/
}
+ // ------------------------------------------------------------------------
+ // Create Anomalies CopyPaste
+ // ------------------------------------------------------------------------
+
/**
* Method cloneAnomaliesCopyPaste
*/
private void cloneAnomaliesCopyPaste() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("cloneAnomaliesCopyPaste");
+
+ r4eAssert.setTest("Copy Elements");
List<IR4EUIModelElement> elementsCopied = new ArrayList<IR4EUIModelElement>();
elementsCopied.add(fAnomaly1);
fProxy.getCommandProxy().copyElements(elementsCopied);
@@ -612,30 +692,41 @@ public class CloneAnomaliesCommentsTests extends TestCase {
.get(0)
.getContentsContainerElement()
.getChildren()[0];
+
+ r4eAssert.setTest("Paste Elements");
List<IR4EUIModelElement> elementsPasted = fProxy.getCommandProxy().pasteElements(targetContent);
fClonedAnomaly4 = (R4EUIAnomalyBasic) elementsPasted.get(0);
- Assert.assertNotNull(fClonedAnomaly4);
- Assert.assertEquals(fAnomaly1.getAnomaly().getTitle(), fClonedAnomaly4.getAnomaly().getTitle());
- Assert.assertEquals(fAnomaly1.getAnomaly().getDescription(), fClonedAnomaly4.getAnomaly().getDescription());
- Assert.assertEquals(((R4ECommentType) fAnomaly1.getAnomaly().getType()).getType(),
+ r4eAssert.assertNotNull(fClonedAnomaly4);
+ r4eAssert.assertEquals(fAnomaly1.getAnomaly().getTitle(), fClonedAnomaly4.getAnomaly().getTitle());
+ r4eAssert.assertEquals(fAnomaly1.getAnomaly().getDescription(), fClonedAnomaly4.getAnomaly().getDescription());
+ r4eAssert.assertEquals(((R4ECommentType) fAnomaly1.getAnomaly().getType()).getType(),
((R4ECommentType) fClonedAnomaly4.getAnomaly().getType()).getType());
- Assert.assertEquals(fAnomaly1.getAnomaly().getRank(), fClonedAnomaly4.getAnomaly().getRank());
- Assert.assertEquals(null, fClonedAnomaly4.getAnomaly().getDueDate());
- Assert.assertEquals(0, fClonedAnomaly4.getAnomaly().getAssignedTo().size());
- Assert.assertEquals(
+ r4eAssert.assertEquals(fAnomaly1.getAnomaly().getRank(), fClonedAnomaly4.getAnomaly().getRank());
+ r4eAssert.assertEquals(null, fClonedAnomaly4.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(0, fClonedAnomaly4.getAnomaly().getAssignedTo().size());
+ r4eAssert.assertEquals(
((R4ETextPosition) targetContent.getContent().getTarget().getLocation()).getStartPosition(),
((R4ETextPosition) ((R4ETextContent) fClonedAnomaly4.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4ETextPosition) targetContent.getContent().getTarget().getLocation()).getLength(),
((R4ETextPosition) ((R4ETextContent) fClonedAnomaly4.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fClonedAnomaly4, true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fClonedAnomaly4, true,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Clone Comment DragDrop
+ // ------------------------------------------------------------------------
+
/**
* Method cloneCommentsDragDrop
*/
private void cloneCommentsDragDrop() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("cloneCommentsDragDrop");
+
+ r4eAssert.setTest("Drag and Drop");
/* TODO drag & drop does not work
List<IR4EUIModelElement> elementsCopied = new ArrayList<IR4EUIModelElement>();
elementsCopied.add(fAnomaly1Comment1);
@@ -643,31 +734,42 @@ public class CloneAnomaliesCommentsTests extends TestCase {
List<IR4EUIModelElement> elementsDropped = fProxy.getCommandProxy().dragDropElements(elementsCopied,
fClonedAnomaly1);
//NOTE: For some reason, only the second comment is selected after the paste, so we use another way of verifying the results
- Assert.assertNotNull(fClonedAnomaly1.getChildren()[0]);
- Assert.assertEquals(fAnomaly1Comment1.getComment().getDescription(),
+ r4eAssert.assertNotNull(fClonedAnomaly1.getChildren()[0]);
+ r4eAssert.assertEquals(fAnomaly1Comment1.getComment().getDescription(),
((R4EUIComment) fClonedAnomaly1.getChildren()[0]).getComment().getDescription());
- Assert.assertNotNull(fClonedAnomaly1.getChildren()[1]);
- Assert.assertEquals(fAnomaly1Comment2.getComment().getDescription(),
+ r4eAssert.assertNotNull(fClonedAnomaly1.getChildren()[1]);
+ r4eAssert.assertEquals(fAnomaly1Comment2.getComment().getDescription(),
((R4EUIComment) fClonedAnomaly1.getChildren()[1]).getComment().getDescription());
*/
}
+ // ------------------------------------------------------------------------
+ // Clone Comment CopyPaste
+ // ------------------------------------------------------------------------
+
/**
* Method cloneCommentsCopyPaste
*/
private void cloneCommentsCopyPaste() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("cloneCommentsCopyPaste");
+
+ r4eAssert.setTest("Copy Elements");
List<IR4EUIModelElement> elementsCopied = new ArrayList<IR4EUIModelElement>();
elementsCopied.add(fAnomaly2Comment1);
elementsCopied.add(fAnomaly2Comment2);
fProxy.getCommandProxy().copyElements(elementsCopied);
+
+ r4eAssert.setTest("Paste Elements");
@SuppressWarnings("unused")
List<IR4EUIModelElement> elementsPasted = fProxy.getCommandProxy().pasteElements(fClonedAnomaly1);
//NOTE: For some reason, only the second comment is selected after the paste, so we use another way of verifying the results
- Assert.assertNotNull(fClonedAnomaly1.getChildren()[0]);
- Assert.assertEquals(fAnomaly2Comment1.getComment().getDescription(),
+ r4eAssert.assertNotNull(fClonedAnomaly1.getChildren()[0]);
+ r4eAssert.assertEquals(fAnomaly2Comment1.getComment().getDescription(),
((R4EUIComment) fClonedAnomaly1.getChildren()[0]).getComment().getDescription());
- Assert.assertNotNull(fClonedAnomaly1.getChildren()[1]);
- Assert.assertEquals(fAnomaly2Comment2.getComment().getDescription(),
+ r4eAssert.assertNotNull(fClonedAnomaly1.getChildren()[1]);
+ r4eAssert.assertEquals(fAnomaly2Comment2.getComment().getDescription(),
((R4EUIComment) fClonedAnomaly1.getChildren()[1]).getComment().getDescription());
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java
index a9675ec..da48116 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java
@@ -13,7 +13,7 @@
*
* Contributors:
* Jacques Bouthillier - Created for Mylyn Review R4E project
- *
+ * Francois Chouinard - Add identifying message to each assert
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.feature;
@@ -24,7 +24,6 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -47,6 +46,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUITextPosition;
import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorActionGroup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
@@ -56,7 +56,7 @@ import org.junit.Before;
* @author Jacques Bouthillier
* @version $Revision: 1.0 $
*/
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class DuplicateAnomalyTests extends TestCase {
// ------------------------------------------------------------------------
@@ -75,6 +75,7 @@ public class DuplicateAnomalyTests extends TestCase {
private R4EUIReviewGroup fGroup = null;
+ @SuppressWarnings("unused")
private String fGroupName = null;
private R4EUIReviewBasic fReview = null;
@@ -91,12 +92,13 @@ public class DuplicateAnomalyTests extends TestCase {
private R4EUIAnomalyBasic fLinkedAnomaly2 = null;
+ @SuppressWarnings("unused")
private final R4EUIAnomalyBasic fLinkedAnomaly3 = null;
private R4EUIAnomalyBasic fExternalAnomaly = null;
// ------------------------------------------------------------------------
- // Methods
+ // Housekeeping
// ------------------------------------------------------------------------
/**
@@ -116,8 +118,8 @@ public class DuplicateAnomalyTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
fProxy = R4EUITestMain.getInstance();
createReviewGroups();
@@ -132,12 +134,16 @@ public class DuplicateAnomalyTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fProxy = null;
}
+ // ------------------------------------------------------------------------
+ // Main test case
+ // ------------------------------------------------------------------------
+
/**
* Method testDuplicationAnomalyInAReviews
*
@@ -151,14 +157,22 @@ public class DuplicateAnomalyTests extends TestCase {
verifyAnomaly();
}
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroups
*/
private void createReviewGroups() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewGroups");
+
fGroup = null;
- //Create Review Group
+ // Create Review Group
+ r4eAssert.setTest("Create Review Group");
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(TestConstants.REVIEW_GROUP_TEST_NAME)) {
fGroup = group;
@@ -172,20 +186,21 @@ public class DuplicateAnomalyTests extends TestCase {
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
- Assert.assertNotNull(fGroup);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertNotNull(fGroup);
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup().getDescription());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
+ .getDescription());
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
.getDefaultEntryCriteria());
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
.getAvailableProjects()
.get(i));
}
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
.getAvailableComponents()
.get(i));
}
@@ -198,36 +213,70 @@ public class DuplicateAnomalyTests extends TestCase {
*/
private void createReviews() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviews");
+
+ r4eAssert.setTest("Open Review Group");
if (!fGroup.isOpen()) {
fProxy.getCommandProxy().openElement(fGroup);
}
- Assert.assertTrue(fGroup.isOpen());
+ r4eAssert.assertTrue(fGroup.isOpen());
+ r4eAssert.setTest("Create Review");
fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TestConstants.REVIEW_DUPLICATE_NAME_INF, TestConstants.REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
TestConstants.REVIEW_TEST_OBJECTIVES, TestConstants.REVIEW_TEST_REFERENCE_MATERIALS);
- Assert.assertNotNull(fReview);
- Assert.assertNotNull(fReview.getParticipantContainer());
- Assert.assertNotNull(fReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
- Assert.assertEquals(TestConstants.REVIEW_DUPLICATE_NAME_INF, fReview.getReview().getName());
- Assert.assertEquals(TestConstants.REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
- Assert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
+ r4eAssert.assertNotNull(fReview);
+ r4eAssert.assertNotNull(fReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
+ r4eAssert.assertEquals(TestConstants.REVIEW_DUPLICATE_NAME_INF, fReview.getReview().getName());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
for (int i = 0; i < TestConstants.REVIEW_TEST_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
}
- Assert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
- Assert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
- Assert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview().getReferenceMaterial());
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview()
+ .getReferenceMaterial());
+ r4eAssert.assertTrue(fReview.isOpen());
+ }
+
+ // ------------------------------------------------------------------------
+ // Create Review Items
+ // ------------------------------------------------------------------------
+
+ /**
+ * Adjust the modified file from the last commit
+ *
+ * @throws CoreException
+ * @throws IOException
+ * @throws URISyntaxException
+ */
+ private static void amendInitialCommit() throws CoreException, IOException, URISyntaxException {
+
+ //Update files ( Modify File 3 since last commit)
+ TestUtils.FJavaFile3 = TestUtils.changeContentOfFile(TestUtils.FJavaFile3, TestUtils.JAVA_FILE3_EXT_MOD_PATH);
+
+ //Commit modifications
+ Collection<String> commitFileList = new ArrayList<String>();
+ commitFileList.add(TestUtils.FJavaFile3.getProjectRelativePath().toOSString());
+
+ TestUtils.commitAmendFiles(TestUtils.FJavaIProject, TestUtils.FJavaRepository, FTHIRD_COMMIT, commitFileList);
}
/**
* Method createReviewItems
*/
private void createReviewItems() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewItems");
+
+ r4eAssert.setTest("Create Commit Item 1");
fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
//close and re-open, so the validation takes de-serialized information
String itemName = fItem.getName();
@@ -239,115 +288,113 @@ public class DuplicateAnomalyTests extends TestCase {
}
}
- //Now validate
- Assert.assertNotNull(fItem);
- Assert.assertTrue(fItem.isOpen());
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
- Assert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
- Assert.assertEquals(FSECOND_COMMIT, fItem.getItem().getDescription());
- Assert.assertEquals(4, fItem.getChildren().length);
+ // Now validate
+ r4eAssert.assertNotNull(fItem);
+ r4eAssert.assertTrue(fItem.isOpen());
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
+ r4eAssert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
+ r4eAssert.assertEquals(FSECOND_COMMIT, fItem.getItem().getDescription());
+ r4eAssert.assertEquals(4, fItem.getChildren().length);
for (int i = 0; i < fItem.getChildren().length; i++) {
if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
- Assert.assertEquals(606, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(606, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(25,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(0)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertEquals(665, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(25, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(0)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertEquals(665, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(63,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(1)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertEquals(733, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(63, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(1)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertEquals(733, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(2)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(61,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(2)
- .getTarget()
- .getLocation()).getLength());
+ r4eAssert.assertEquals(61, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(2)
+ .getTarget()
+ .getLocation()).getLength());
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE4_PROJ_NAME)) {
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE3_PROJ_NAME)) {
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE2_PROJ_NAME)) {
- Assert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getTarget());
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getTarget());
}
}
+ r4eAssert.setTest("Create Manual Tree Item 1");
fItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
- Assert.assertNotNull(fItem2);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
+ r4eAssert.assertNotNull(fItem2);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(0, ((R4ETextPosition) fItem2.getItem()
+ r4eAssert.assertEquals(0, ((R4ETextPosition) fItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(755, ((R4ETextPosition) fItem2.getItem()
+ r4eAssert.assertEquals(755, ((R4ETextPosition) fItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
@@ -355,27 +402,28 @@ public class DuplicateAnomalyTests extends TestCase {
.getTarget()
.getLocation()).getLength());
+ r4eAssert.setTest("Create Manual Text Item 1");
fItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
- Assert.assertNotNull(fItem3);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
+ r4eAssert.assertNotNull(fItem3);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(50, ((R4ETextPosition) fItem3.getItem()
+ r4eAssert.assertEquals(50, ((R4ETextPosition) fItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(20, ((R4ETextPosition) fItem3.getItem()
+ r4eAssert.assertEquals(20, ((R4ETextPosition) fItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
@@ -390,6 +438,8 @@ public class DuplicateAnomalyTests extends TestCase {
} catch (URISyntaxException e) {
e.printStackTrace();
}
+
+ r4eAssert.setTest("Create Commit Item 2");
fItem4 = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
//Validate the last Commit
@@ -402,12 +452,12 @@ public class DuplicateAnomalyTests extends TestCase {
/* JAVA_FILE4_PROJ_NAME = same file */
/* */
/************************************************************** */
- Assert.assertNotNull(fItem4);
- Assert.assertTrue(fItem4.isOpen());
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem4.getItem().getAddedById());
- Assert.assertEquals("The.committer@some.com", fItem4.getItem().getAuthorRep());
- Assert.assertEquals(FTHIRD_COMMIT, fItem4.getItem().getDescription());
- Assert.assertEquals(4, fItem4.getChildren().length);
+ r4eAssert.assertNotNull(fItem4);
+ r4eAssert.assertTrue(fItem4.isOpen());
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem4.getItem().getAddedById());
+ r4eAssert.assertEquals("The.committer@some.com", fItem4.getItem().getAuthorRep());
+ r4eAssert.assertEquals(FTHIRD_COMMIT, fItem4.getItem().getDescription());
+ r4eAssert.assertEquals(4, fItem4.getChildren().length);
for (int i = 0; i < fItem4.getChildren().length; i++) {
if (((R4EUIFileContext) fItem4.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
String testfileVersion = null;
@@ -424,50 +474,50 @@ public class DuplicateAnomalyTests extends TestCase {
}
R4EFileVersion item4FileVersion = fItem4.getItem().getFileContextList().get(i).getTarget();
if (item4FileVersion != null) {
- Assert.assertEquals(testfileVersion, item4FileVersion.getLocalVersionID());
+ r4eAssert.assertEquals(testfileVersion, item4FileVersion.getLocalVersionID());
}
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem4.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem4.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertEquals(606, ((R4ETextPosition) fItem4.getItem()
+ r4eAssert.assertEquals(606, ((R4ETextPosition) fItem4.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(25, ((R4ETextPosition) fItem4.getItem()
+ r4eAssert.assertEquals(25, ((R4ETextPosition) fItem4.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertEquals(665, ((R4ETextPosition) fItem4.getItem()
+ r4eAssert.assertEquals(665, ((R4ETextPosition) fItem4.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(63, ((R4ETextPosition) fItem4.getItem()
+ r4eAssert.assertEquals(63, ((R4ETextPosition) fItem4.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getLength());
- Assert.assertEquals(733, ((R4ETextPosition) fItem4.getItem()
+ r4eAssert.assertEquals(733, ((R4ETextPosition) fItem4.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(2)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(61, ((R4ETextPosition) fItem4.getItem()
+ r4eAssert.assertEquals(61, ((R4ETextPosition) fItem4.getItem()
.getFileContextList()
.get(i)
.getDeltas()
@@ -475,7 +525,7 @@ public class DuplicateAnomalyTests extends TestCase {
.getTarget()
.getLocation()).getLength());
} else if (((R4EUIFileContext) fItem4.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE4_PROJ_NAME)) {
- Assert.assertNull(fItem4.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertNull(fItem4.getItem().getFileContextList().get(i).getBase());
String testfileVersion = null;
R4EFileVersion origFileVersion = null;
for (int j = 0; j < fItem.getChildren().length; j++) {
@@ -490,10 +540,10 @@ public class DuplicateAnomalyTests extends TestCase {
}
R4EFileVersion item4FileVersion = fItem4.getItem().getFileContextList().get(i).getTarget();
if (item4FileVersion != null) {
- Assert.assertEquals(testfileVersion, item4FileVersion.getLocalVersionID());
+ r4eAssert.assertEquals(testfileVersion, item4FileVersion.getLocalVersionID());
}
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem4.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem4.getItem()
.getFileContextList()
.get(i)
.getTarget()
@@ -514,11 +564,11 @@ public class DuplicateAnomalyTests extends TestCase {
}
R4EFileVersion item4FileVersion = fItem4.getItem().getFileContextList().get(i).getTarget();
if (item4FileVersion != null) {
- Assert.assertNotSame(testfileVersion, item4FileVersion.getLocalVersionID());
+ r4eAssert.assertNotSame(testfileVersion, item4FileVersion.getLocalVersionID());
}
- Assert.assertNull(fItem4.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem4.getItem()
+ r4eAssert.assertNull(fItem4.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem4.getItem()
.getFileContextList()
.get(i)
.getTarget()
@@ -539,75 +589,87 @@ public class DuplicateAnomalyTests extends TestCase {
}
R4EFileVersion item4FileVersion = fItem4.getItem().getFileContextList().get(i).getBase();
if (item4FileVersion != null) {
- Assert.assertEquals(testfileVersion, item4FileVersion.getLocalVersionID());
+ r4eAssert.assertEquals(testfileVersion, item4FileVersion.getLocalVersionID());
}
- Assert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem4.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem4.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertNull(fItem4.getItem().getFileContextList().get(i).getTarget());
+ r4eAssert.assertNull(fItem4.getItem().getFileContextList().get(i).getTarget());
}
}
}
+ // ------------------------------------------------------------------------
+ // Create Linked Anomalies
+ // ------------------------------------------------------------------------
+
/**
* Method createLinkedAnomalies
*/
private void createLinkedAnomalies() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createLinkedAnomalies");
+
+ r4eAssert.setTest("Create Linked Anomaly 1");
int sizeItem = fItem.getChildren().length;
R4EUIContent content = null;
for (int i = 0; i < sizeItem; i++) {
if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
//Create an anomaly for JAVA_FILE1_PROJ_NAME
//Same file, so the anomaly should only show in the last commit
+ r4eAssert.setTest("Create Linked Anomaly 1");
content = fItem.getFileContexts().get(i).getContentsContainerElement().getContentsList().get(0);
fLinkedAnomaly1 = fProxy.getAnomalyProxy().createLinkedAnomaly(content,
TestConstants.LINKED_ANOMALY_TEST_TITLE, TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fLinkedAnomaly1);
- Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly1.getAnomaly().getTitle());
- Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly1.getAnomaly()
+ r4eAssert.assertNotNull(fLinkedAnomaly1);
+ r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly1.getAnomaly().getTitle());
+ r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly1.getAnomaly()
.getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
((R4ECommentType) fLinkedAnomaly1.getAnomaly().getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly1.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly1.getAnomaly().getDueDate());
- Assert.assertEquals(
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly1.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly1.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getOffset(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly1.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly1.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly1.getAnomaly()
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly1.getAnomaly()
.getAssignedTo()
.get(0));
//Add a second anomaly
+ r4eAssert.setTest("Create Linked Anomaly 2");
if (fItem.getFileContexts().get(i).getContentsContainerElement().getContentsList().size() >= 3) {
content = fItem.getFileContexts().get(i).getContentsContainerElement().getContentsList().get(2);
fLinkedAnomaly2 = fProxy.getAnomalyProxy().createLinkedAnomaly(content,
TestConstants.LINKED_ANOMALY_TEST_TITLE, TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fLinkedAnomaly2);
- Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly2.getAnomaly()
+ r4eAssert.assertNotNull(fLinkedAnomaly2);
+ r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly2.getAnomaly()
.getTitle());
- Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly2.getAnomaly()
+ r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly2.getAnomaly()
.getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
((R4ECommentType) fLinkedAnomaly2.getAnomaly().getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly2.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly2.getAnomaly().getDueDate());
- Assert.assertEquals(
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly2.getAnomaly()
+ .getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly2.getAnomaly()
+ .getDueDate());
+ r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getOffset(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly2.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly2.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly2.getAnomaly()
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly2.getAnomaly()
.getAssignedTo()
.get(0));
@@ -625,21 +687,21 @@ public class DuplicateAnomalyTests extends TestCase {
// TestConstants.LINKED_ANOMALY_TEST_TITLE, TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION,
// TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR,
// TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
-// Assert.assertNotNull(fLinkedAnomaly3);
-// Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly3.getAnomaly().getTitle());
-// Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly3.getAnomaly()
+// r4eAssert.assertNotNull(fLinkedAnomaly3);
+// r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly3.getAnomaly().getTitle());
+// r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly3.getAnomaly()
// .getDescription());
-// Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
+// r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
// ((R4ECommentType) fLinkedAnomaly3.getAnomaly().getType()).getType());
-// Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly3.getAnomaly().getRank());
-// Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly3.getAnomaly().getDueDate());
-// Assert.assertEquals(
+// r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly3.getAnomaly().getRank());
+// r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly3.getAnomaly().getDueDate());
+// r4eAssert.assertEquals(
// ((R4EUITextPosition) content.getPosition()).getOffset(),
// ((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly3.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
-// Assert.assertEquals(
+// r4eAssert.assertEquals(
// ((R4EUITextPosition) content.getPosition()).getLength(),
// ((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly3.getAnomaly().getLocation().get(0)).getLocation()).getLength());
-// Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly3.getAnomaly()
+// r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly3.getAnomaly()
// .getAssignedTo()
// .get(0));
// }
@@ -651,38 +713,54 @@ public class DuplicateAnomalyTests extends TestCase {
}
+ // ------------------------------------------------------------------------
+ // Create External Anomalies
+ // ------------------------------------------------------------------------
+
/**
* Method createExternalAnomalies
*/
private void createExternalAnomalies() {
- //Create an external from the last commit
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createExternalAnomalies");
+
+ // Create an external anomaly from the last commit
+ r4eAssert.setTest("Create External Anomaly");
fExternalAnomaly = fProxy.getAnomalyProxy().createExternalAnomaly(TestUtils.FJavaFile3,
TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_QUESTION, TestConstants.ANOMALY_TEST_RANK_MINOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fExternalAnomaly);
- Assert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, fExternalAnomaly.getAnomaly().getTitle());
- Assert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION, fExternalAnomaly.getAnomaly()
+ r4eAssert.assertNotNull(fExternalAnomaly);
+ r4eAssert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, fExternalAnomaly.getAnomaly().getTitle());
+ r4eAssert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION, fExternalAnomaly.getAnomaly()
.getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_QUESTION, ((R4ECommentType) fExternalAnomaly.getAnomaly()
- .getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fExternalAnomaly.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fExternalAnomaly.getAnomaly().getDueDate());
- Assert.assertEquals(
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_QUESTION,
+ ((R4ECommentType) fExternalAnomaly.getAnomaly().getType()).getType());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fExternalAnomaly.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fExternalAnomaly.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(
0,
((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(764, ((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly()
+ r4eAssert.assertEquals(764, ((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
}
+ // ------------------------------------------------------------------------
+ // Verify Anomalies
+ // ------------------------------------------------------------------------
+
/**
* Look where the anomaly are stored now after re-opening the review
*/
private void verifyAnomaly() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("verifyAnomaly");
+
+ r4eAssert.setTest("Verify Anomaly");
String comit1 = fItem.getName();
String commit2 = fItem4.getName();
fProxy.getCommandProxy().closeElement(fReview);
@@ -712,28 +790,9 @@ public class DuplicateAnomalyTests extends TestCase {
}
}
//Verify the anomaly count under the appropriate file
- Assert.assertEquals(0, anomalyCount1);
- Assert.assertEquals(2, anomalyCount4);
-
- }
+ r4eAssert.assertEquals(0, anomalyCount1);
+ r4eAssert.assertEquals(2, anomalyCount4);
- /**
- * Adjust the modified file from the last commit
- *
- * @throws CoreException
- * @throws IOException
- * @throws URISyntaxException
- */
- private static void amendInitialCommit() throws CoreException, IOException, URISyntaxException {
-
- //Update files ( Modify File 3 since last commit)
- TestUtils.FJavaFile3 = TestUtils.changeContentOfFile(TestUtils.FJavaFile3, TestUtils.JAVA_FILE3_EXT_MOD_PATH);
-
- //Commit modifications
- Collection<String> commitFileList = new ArrayList<String>();
- commitFileList.add(TestUtils.FJavaFile3.getProjectRelativePath().toOSString());
-
- TestUtils.commitAmendFiles(TestUtils.FJavaIProject, TestUtils.FJavaRepository, FTHIRD_COMMIT, commitFileList);
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java
index 0216ccb..342255c 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java
@@ -12,7 +12,7 @@
*
* Contributors:
* Sebastien Dubois - Created for Mylyn Review R4E project
- *
+ * Francois Chouinard - Add identifying message to each assert
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.feature;
@@ -21,7 +21,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -36,7 +35,6 @@ import org.eclipse.mylyn.reviews.r4e.core.model.R4EUserRole;
import org.eclipse.mylyn.reviews.r4e.core.model.RModelFactory;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.IR4EUIModelElement;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIAnomalyBasic;
-import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIAnomalyContainer;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIContent;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIFileContext;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIModelController;
@@ -52,12 +50,13 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorAction
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
import org.junit.Before;
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class PostponedAnomaliesTests extends TestCase {
// ------------------------------------------------------------------------
@@ -143,7 +142,7 @@ public class PostponedAnomaliesTests extends TestCase {
private String fOriginalGlobalAnomalyTitle = null;
// ------------------------------------------------------------------------
- // Methods
+ // Housekeeping
// ------------------------------------------------------------------------
/**
@@ -163,8 +162,8 @@ public class PostponedAnomaliesTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
fProxy = R4EUITestMain.getInstance();
fProxy.getPreferencesProxy().setGlobalPostponedImport(true);
@@ -183,21 +182,25 @@ public class PostponedAnomaliesTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fProxy = null;
}
+ // ------------------------------------------------------------------------
+ // Main test case
+ // ------------------------------------------------------------------------
+
/**
- * Method testBasicReviews
+ * Method testPostponedAnomalies
*
* @throws CoreException
*/
public void testPostponedAnomalies() throws CoreException {
TestUtils.waitForJobs();
- //Global Anomalies
+ // Global Anomalies
createOriginalGlobalPostponedAnomalies();
createGlobalTargetReview();
importGlobalAnomalies();
@@ -205,7 +208,7 @@ public class PostponedAnomaliesTests extends TestCase {
changeOriginalGlobalAnomaliesState();
fixGlobalPostponedAnomalies();
- //Local Anomalies
+ // Local Anomalies
createTargetReview();
createTargetReviewItem();
createParticipants(fTargetReview);
@@ -215,14 +218,22 @@ public class PostponedAnomaliesTests extends TestCase {
fixPostponedAnomalies();
}
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroups
*/
private void createReviewGroups() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewGroups");
+
fGroup = null;
- //Create Review Group
+ // Create Review Group
+ r4eAssert.setTest("Create Review Group");
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(TestConstants.REVIEW_GROUP_TEST_NAME)) {
fGroup = group;
@@ -236,20 +247,21 @@ public class PostponedAnomaliesTests extends TestCase {
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
- Assert.assertNotNull(fGroup);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertNotNull(fGroup);
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup().getDescription());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
+ .getDescription());
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
.getDefaultEntryCriteria());
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
.getAvailableProjects()
.get(i));
}
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
.getAvailableComponents()
.get(i));
}
@@ -261,7 +273,12 @@ public class PostponedAnomaliesTests extends TestCase {
* Method createOriginalReview
*/
private void createOriginalReview() {
- //Update Review Group handle
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createOriginalReview");
+
+ // Update Review Group handle
+ r4eAssert.setTest("Update Review Group Handle");
for (IR4EUIModelElement elem : R4EUIModelController.getRootElement().getChildren()) {
if (fGroupName.equals(elem.getName())) {
fGroup = (R4EUIReviewGroup) elem;
@@ -270,91 +287,98 @@ public class PostponedAnomaliesTests extends TestCase {
if (!fGroup.isOpen()) {
fProxy.getCommandProxy().openElement(fGroup);
}
- Assert.assertTrue(fGroup.isOpen());
+ r4eAssert.assertTrue(fGroup.isOpen());
+ // Create Review Group
+ r4eAssert.setTest("Create Review Group");
fOriginalReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
ORIGINAL_REVIEW_TEST_NAME, ORIGINAL_REVIEW_TEST_DESCRIPTION, TestConstants.REVIEW_TEST_DUE_DATE,
TestConstants.REVIEW_TEST_PROJECT, TestConstants.REVIEW_TEST_COMPONENTS,
TestConstants.REVIEW_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_TEST_OBJECTIVES,
TestConstants.REVIEW_TEST_REFERENCE_MATERIALS);
- Assert.assertNotNull(fOriginalReview);
- Assert.assertNotNull(fOriginalReview.getParticipantContainer());
- Assert.assertNotNull(fOriginalReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fOriginalReview.getReview().getType());
- Assert.assertEquals(ORIGINAL_REVIEW_TEST_NAME, fOriginalReview.getReview().getName());
- Assert.assertEquals(ORIGINAL_REVIEW_TEST_DESCRIPTION, fOriginalReview.getReview().getExtraNotes());
- Assert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fOriginalReview.getReview().getProject());
+ r4eAssert.assertNotNull(fOriginalReview);
+ r4eAssert.assertNotNull(fOriginalReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fOriginalReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fOriginalReview.getReview().getType());
+ r4eAssert.assertEquals(ORIGINAL_REVIEW_TEST_NAME, fOriginalReview.getReview().getName());
+ r4eAssert.assertEquals(ORIGINAL_REVIEW_TEST_DESCRIPTION, fOriginalReview.getReview().getExtraNotes());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fOriginalReview.getReview().getProject());
for (int i = 0; i < TestConstants.REVIEW_TEST_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fOriginalReview.getReview()
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fOriginalReview.getReview()
.getComponents()
.get(i));
}
- Assert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fOriginalReview.getReview().getEntryCriteria());
- Assert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fOriginalReview.getReview().getObjectives());
- Assert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fOriginalReview.getReview()
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fOriginalReview.getReview().getEntryCriteria());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fOriginalReview.getReview().getObjectives());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fOriginalReview.getReview()
.getReferenceMaterial());
- Assert.assertTrue(fOriginalReview.isOpen());
+ r4eAssert.assertTrue(fOriginalReview.isOpen());
}
/**
* Method createOriginalReviewItem
*/
private void createOriginalReviewItem() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createOriginalReviewItem");
+
+ r4eAssert.setTest("Create Commit Item");
fOriginalItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
- Assert.assertNotNull(fOriginalItem);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fOriginalItem.getItem().getAddedById());
- Assert.assertEquals("The.committer@some.com", fOriginalItem.getItem().getAuthorRep());
- Assert.assertEquals("second Java Commit", fOriginalItem.getItem().getDescription());
- Assert.assertEquals(4, fOriginalItem.getChildren().length);
+ r4eAssert.assertNotNull(fOriginalItem);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fOriginalItem.getItem().getAddedById());
+ r4eAssert.assertEquals("The.committer@some.com", fOriginalItem.getItem().getAuthorRep());
+ r4eAssert.assertEquals("second Java Commit", fOriginalItem.getItem().getDescription());
+ r4eAssert.assertEquals(4, fOriginalItem.getChildren().length);
for (int i = 0; i < fOriginalItem.getChildren().length; i++) {
if (((R4EUIFileContext) fOriginalItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
fOrigAnomalyFileIndex = i; //Used later to add anomalies
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fOriginalItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fOriginalItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
- Assert.assertEquals(606, ((R4ETextPosition) fOriginalItem.getItem()
+ r4eAssert.assertEquals(606, ((R4ETextPosition) fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(25, ((R4ETextPosition) fOriginalItem.getItem()
+ r4eAssert.assertEquals(25, ((R4ETextPosition) fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertEquals(665, ((R4ETextPosition) fOriginalItem.getItem()
+ r4eAssert.assertEquals(665, ((R4ETextPosition) fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(63, ((R4ETextPosition) fOriginalItem.getItem()
+ r4eAssert.assertEquals(63, ((R4ETextPosition) fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getLength());
- Assert.assertEquals(733, ((R4ETextPosition) fOriginalItem.getItem()
+ r4eAssert.assertEquals(733, ((R4ETextPosition) fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(2)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(61, ((R4ETextPosition) fOriginalItem.getItem()
+ r4eAssert.assertEquals(61, ((R4ETextPosition) fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
@@ -365,54 +389,54 @@ public class PostponedAnomaliesTests extends TestCase {
fFile1VersionID = fOriginalItem.getFileContexts().get(i).getTargetFileVersion().getVersionID();
} else if (((R4EUIFileContext) fOriginalItem.getChildren()[i]).getName().equals(
TestUtils.JAVA_FILE4_PROJ_NAME)) {
- Assert.assertNull(fOriginalItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertNull(fOriginalItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fOriginalItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fOriginalItem.getChildren()[i]).getName().equals(
TestUtils.JAVA_FILE3_PROJ_NAME)) {
- Assert.assertNull(fOriginalItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fOriginalItem.getItem()
+ r4eAssert.assertNull(fOriginalItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fOriginalItem.getChildren()[i]).getName().equals(
TestUtils.JAVA_FILE2_PROJ_NAME)) {
- Assert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fOriginalItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fOriginalItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertNull(fOriginalItem.getItem().getFileContextList().get(i).getTarget());
+ r4eAssert.assertNull(fOriginalItem.getItem().getFileContextList().get(i).getTarget());
}
}
+ r4eAssert.setTest("Create Manual Tree Item");
fOriginalItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
- Assert.assertNotNull(fOriginalItem2);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fOriginalItem2.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fOriginalItem2.getItem()
+ r4eAssert.assertNotNull(fOriginalItem2);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fOriginalItem2.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fOriginalItem2.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fOriginalItem2.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fOriginalItem2.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(0,
- ((R4ETextPosition) fOriginalItem2.getItem()
- .getFileContextList()
- .get(0)
- .getDeltas()
- .get(0)
- .getTarget()
- .getLocation()).getStartPosition());
- Assert.assertEquals(755, ((R4ETextPosition) fOriginalItem2.getItem()
+ r4eAssert.assertEquals(0, ((R4ETextPosition) fOriginalItem2.getItem()
+ .getFileContextList()
+ .get(0)
+ .getDeltas()
+ .get(0)
+ .getTarget()
+ .getLocation()).getStartPosition());
+ r4eAssert.assertEquals(755, ((R4ETextPosition) fOriginalItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
@@ -420,27 +444,28 @@ public class PostponedAnomaliesTests extends TestCase {
.getTarget()
.getLocation()).getLength());
+ r4eAssert.setTest("Create Manual Text Item");
fOriginalItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
- Assert.assertNotNull(fOriginalItem3);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fOriginalItem3.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fOriginalItem3.getItem()
+ r4eAssert.assertNotNull(fOriginalItem3);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fOriginalItem3.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fOriginalItem3.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fOriginalItem3.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fOriginalItem3.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(50, ((R4ETextPosition) fOriginalItem3.getItem()
+ r4eAssert.assertEquals(50, ((R4ETextPosition) fOriginalItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(20, ((R4ETextPosition) fOriginalItem3.getItem()
+ r4eAssert.assertEquals(20, ((R4ETextPosition) fOriginalItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
@@ -457,6 +482,11 @@ public class PostponedAnomaliesTests extends TestCase {
* @param aReview
*/
private void createParticipants(R4EUIReviewBasic aReview) {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createParticipants");
+
+ r4eAssert.setTest("Create Participant");
List<R4EParticipant> participants = new ArrayList<R4EParticipant>(1);
R4EParticipant participant = RModelFactory.eINSTANCE.createR4EParticipant();
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
@@ -464,17 +494,26 @@ public class PostponedAnomaliesTests extends TestCase {
participants.add(participant);
R4EUIParticipant uiParticipant = fProxy.getParticipantProxy().createParticipant(
aReview.getParticipantContainer(), participants);
- Assert.assertNotNull(uiParticipant);
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, uiParticipant.getParticipant().getId());
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, uiParticipant.getParticipant().getEmail());
- Assert.assertEquals(R4EUserRole.R4E_ROLE_REVIEWER, uiParticipant.getParticipant().getRoles().get(0));
+ r4eAssert.assertNotNull(uiParticipant);
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, uiParticipant.getParticipant().getId());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, uiParticipant.getParticipant().getEmail());
+ r4eAssert.assertEquals(R4EUserRole.R4E_ROLE_REVIEWER, uiParticipant.getParticipant().getRoles().get(0));
}
+ // ------------------------------------------------------------------------
+ // Create Original Postponed Anomalies
+ // ------------------------------------------------------------------------
+
/**
* Method createOriginalPostponedAnomalies
*/
private void createOriginalPostponedAnomalies() {
- //Anomaly1
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createOriginalPostponedAnomalies");
+
+ // Anomaly1
+ r4eAssert.setTest("Anomaly 1");
R4EUIContent content1 = fOriginalItem.getFileContexts()
.get(fOrigAnomalyFileIndex)
.getContentsContainerElement()
@@ -484,25 +523,27 @@ public class PostponedAnomaliesTests extends TestCase {
ORIGINAL_ANOMALY1_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fOriginalAnomaly1);
- Assert.assertEquals(ORIGINAL_ANOMALY1_TEST_TITLE, fOriginalAnomaly1.getAnomaly().getTitle());
- Assert.assertEquals(ORIGINAL_ANOMALY1_TEST_DESCRIPTION, fOriginalAnomaly1.getAnomaly().getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
+ r4eAssert.assertNotNull(fOriginalAnomaly1);
+ r4eAssert.assertEquals(ORIGINAL_ANOMALY1_TEST_TITLE, fOriginalAnomaly1.getAnomaly().getTitle());
+ r4eAssert.assertEquals(ORIGINAL_ANOMALY1_TEST_DESCRIPTION, fOriginalAnomaly1.getAnomaly().getDescription());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
((R4ECommentType) fOriginalAnomaly1.getAnomaly().getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fOriginalAnomaly1.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fOriginalAnomaly1.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fOriginalAnomaly1.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fOriginalAnomaly1.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fOriginalAnomaly1.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO,
+ fOriginalAnomaly1.getAnomaly().getAssignedTo().get(0));
+ r4eAssert.assertEquals(
((R4EUITextPosition) content1.getPosition()).getOffset(),
((R4ETextPosition) ((R4ETextContent) fOriginalAnomaly1.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4EUITextPosition) content1.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fOriginalAnomaly1.getAnomaly().getLocation().get(0)).getLocation()).getLength());
fProxy.getAnomalyProxy().progressAnomaly(fOriginalAnomaly1, TestConstants.ANOMALY_STATE_POSTPONED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly1.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly1.getAnomaly().getState());
fOriginalAnomaly1Title = fOriginalAnomaly1.getAnomaly().getTitle();
- //Anomaly2
+ // Anomaly2
+ r4eAssert.setTest("Anomaly 2");
R4EUIContent content2 = fOriginalItem.getFileContexts()
.get(fOrigAnomalyFileIndex)
.getContentsContainerElement()
@@ -512,261 +553,302 @@ public class PostponedAnomaliesTests extends TestCase {
ORIGINAL_ANOMALY2_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fOriginalAnomaly2);
- Assert.assertEquals(ORIGINAL_ANOMALY2_TEST_TITLE, fOriginalAnomaly2.getAnomaly().getTitle());
- Assert.assertEquals(ORIGINAL_ANOMALY2_TEST_DESCRIPTION, fOriginalAnomaly2.getAnomaly().getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
+ r4eAssert.assertNotNull(fOriginalAnomaly2);
+ r4eAssert.assertEquals(ORIGINAL_ANOMALY2_TEST_TITLE, fOriginalAnomaly2.getAnomaly().getTitle());
+ r4eAssert.assertEquals(ORIGINAL_ANOMALY2_TEST_DESCRIPTION, fOriginalAnomaly2.getAnomaly().getDescription());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
((R4ECommentType) fOriginalAnomaly2.getAnomaly().getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fOriginalAnomaly2.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fOriginalAnomaly2.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fOriginalAnomaly2.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fOriginalAnomaly2.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fOriginalAnomaly2.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO,
+ fOriginalAnomaly2.getAnomaly().getAssignedTo().get(0));
+ r4eAssert.assertEquals(
((R4EUITextPosition) content2.getPosition()).getOffset(),
((R4ETextPosition) ((R4ETextContent) fOriginalAnomaly2.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4EUITextPosition) content2.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fOriginalAnomaly2.getAnomaly().getLocation().get(0)).getLocation()).getLength());
fProxy.getAnomalyProxy().progressAnomaly(fOriginalAnomaly2, TestConstants.ANOMALY_STATE_POSTPONED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly2.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly2.getAnomaly().getState());
fOriginalAnomaly2Title = fOriginalAnomaly2.getAnomaly().getTitle();
}
+ // ------------------------------------------------------------------------
+ // Create Target Review
+ // ------------------------------------------------------------------------
+
/**
* Method createTargetReview
*/
private void createTargetReview() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createTargetReview");
+
+ r4eAssert.setTest("Create Review");
fTargetReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TARGET_REVIEW_TEST_NAME, TARGET_REVIEW_TEST_DESCRIPTION, TestConstants.REVIEW_TEST_DUE_DATE,
TestConstants.REVIEW_TEST_PROJECT, TestConstants.REVIEW_TEST_COMPONENTS,
TestConstants.REVIEW_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_TEST_OBJECTIVES,
TestConstants.REVIEW_TEST_REFERENCE_MATERIALS);
- Assert.assertNotNull(fTargetReview);
- Assert.assertNotNull(fTargetReview.getParticipantContainer());
- Assert.assertNotNull(fTargetReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fTargetReview.getReview().getType());
- Assert.assertEquals(TARGET_REVIEW_TEST_NAME, fTargetReview.getReview().getName());
- Assert.assertEquals(TARGET_REVIEW_TEST_DESCRIPTION, fTargetReview.getReview().getExtraNotes());
- Assert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fTargetReview.getReview().getProject());
+ r4eAssert.assertNotNull(fTargetReview);
+ r4eAssert.assertNotNull(fTargetReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fTargetReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fTargetReview.getReview().getType());
+ r4eAssert.assertEquals(TARGET_REVIEW_TEST_NAME, fTargetReview.getReview().getName());
+ r4eAssert.assertEquals(TARGET_REVIEW_TEST_DESCRIPTION, fTargetReview.getReview().getExtraNotes());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fTargetReview.getReview().getProject());
for (int i = 0; i < TestConstants.REVIEW_TEST_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i],
- fTargetReview.getReview().getComponents().get(i));
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fTargetReview.getReview()
+ .getComponents()
+ .get(i));
}
- Assert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fTargetReview.getReview().getEntryCriteria());
- Assert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fTargetReview.getReview().getObjectives());
- Assert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fTargetReview.getReview()
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fTargetReview.getReview().getEntryCriteria());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fTargetReview.getReview().getObjectives());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fTargetReview.getReview()
.getReferenceMaterial());
- Assert.assertTrue(fTargetReview.isOpen());
+ r4eAssert.assertTrue(fTargetReview.isOpen());
}
+ // ------------------------------------------------------------------------
+ // Create Target Review Item
+ // ------------------------------------------------------------------------
+
/**
* Method createTargetReviewItem
*/
private void createTargetReviewItem() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createTargetReviewItem");
+
+ r4eAssert.setTest("Create Commit Item");
fTargetItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
- Assert.assertNotNull(fTargetItem);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fTargetItem.getItem().getAddedById());
- Assert.assertEquals("The.committer@some.com", fTargetItem.getItem().getAuthorRep());
- Assert.assertEquals("second Java Commit", fTargetItem.getItem().getDescription());
- Assert.assertEquals(4, fTargetItem.getChildren().length);
+ r4eAssert.assertNotNull(fTargetItem);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fTargetItem.getItem().getAddedById());
+ r4eAssert.assertEquals("The.committer@some.com", fTargetItem.getItem().getAuthorRep());
+ r4eAssert.assertEquals("second Java Commit", fTargetItem.getItem().getDescription());
+ r4eAssert.assertEquals(4, fTargetItem.getChildren().length);
for (int i = 0; i < fTargetItem.getChildren().length; i++) {
if (((R4EUIFileContext) fTargetItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fTargetItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fTargetItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fTargetItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fTargetItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
- Assert.assertEquals(606, ((R4ETextPosition) fTargetItem.getItem()
+ r4eAssert.assertEquals(606, ((R4ETextPosition) fTargetItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(25, ((R4ETextPosition) fTargetItem.getItem()
+ r4eAssert.assertEquals(25, ((R4ETextPosition) fTargetItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertEquals(665, ((R4ETextPosition) fTargetItem.getItem()
+ r4eAssert.assertEquals(665, ((R4ETextPosition) fTargetItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(63, ((R4ETextPosition) fTargetItem.getItem()
+ r4eAssert.assertEquals(63, ((R4ETextPosition) fTargetItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getLength());
- Assert.assertEquals(733, ((R4ETextPosition) fTargetItem.getItem()
+ r4eAssert.assertEquals(733, ((R4ETextPosition) fTargetItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(2)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(61, ((R4ETextPosition) fTargetItem.getItem()
+ r4eAssert.assertEquals(61, ((R4ETextPosition) fTargetItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(2)
.getTarget()
.getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fTargetItem.getChildren()[i]).getContentsContainerElement().getChildren(),
true, R4EUIConstants.DELTA_ANNOTATION_ID));
} else if (((R4EUIFileContext) fTargetItem.getChildren()[i]).getName().equals(
TestUtils.JAVA_FILE4_PROJ_NAME)) {
- Assert.assertNull(fTargetItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fTargetItem.getItem()
+ r4eAssert.assertNull(fTargetItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fTargetItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fTargetItem.getChildren()[i]).getName().equals(
TestUtils.JAVA_FILE3_PROJ_NAME)) {
- Assert.assertNull(fTargetItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fTargetItem.getItem()
+ r4eAssert.assertNull(fTargetItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fTargetItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fTargetItem.getChildren()[i]).getName().equals(
TestUtils.JAVA_FILE2_PROJ_NAME)) {
- Assert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fTargetItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fTargetItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertNull(fTargetItem.getItem().getFileContextList().get(i).getTarget());
+ r4eAssert.assertNull(fTargetItem.getItem().getFileContextList().get(i).getTarget());
}
}
+ r4eAssert.setTest("Create Manual Tree Item");
fTargetItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
- Assert.assertNotNull(fTargetItem2);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fTargetItem2.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fTargetItem2.getItem()
+ r4eAssert.assertNotNull(fTargetItem2);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fTargetItem2.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fTargetItem2.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fTargetItem2.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fTargetItem2.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(0, ((R4ETextPosition) fTargetItem2.getItem()
+ r4eAssert.assertEquals(0, ((R4ETextPosition) fTargetItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(755,
- ((R4ETextPosition) fTargetItem2.getItem()
- .getFileContextList()
- .get(0)
- .getDeltas()
- .get(0)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertEquals(755, ((R4ETextPosition) fTargetItem2.getItem()
+ .getFileContextList()
+ .get(0)
+ .getDeltas()
+ .get(0)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fTargetItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.setTest("Create Manual Text Item");
fTargetItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
- Assert.assertNotNull(fTargetItem3);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fTargetItem3.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fTargetItem3.getItem()
+ r4eAssert.assertNotNull(fTargetItem3);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fTargetItem3.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fTargetItem3.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fTargetItem3.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fTargetItem3.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(50, ((R4ETextPosition) fTargetItem3.getItem()
+ r4eAssert.assertEquals(50, ((R4ETextPosition) fTargetItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(20, ((R4ETextPosition) fTargetItem3.getItem()
+ r4eAssert.assertEquals(20, ((R4ETextPosition) fTargetItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fTargetItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
R4EUIConstants.SELECTION_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Import Anomalies
+ // ------------------------------------------------------------------------
+
/**
* Method importAnomalies
*/
private void importAnomalies() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("importAnomalies");
+
+ r4eAssert.setTest("Import Postponed Anomaly");
fProxy.getCommandProxy().importPostponedAnomalies(fTargetReview);
- //Verify that the postponed anomalies were correctly imported
+ // Verify that the postponed anomalies were correctly imported
R4EUIPostponedContainer postponedContainer = fTargetReview.getPostponedContainer();
- Assert.assertNotNull(postponedContainer);
+ r4eAssert.assertNotNull(postponedContainer);
R4EUIPostponedFile postponedFile = (R4EUIPostponedFile) postponedContainer.getChildren()[0];
- Assert.assertNotNull(postponedFile);
- Assert.assertEquals(fFile1Name, postponedFile.getName());
- Assert.assertEquals(fFile1VersionID, postponedFile.getTargetFileVersion().getVersionID());
+ r4eAssert.assertNotNull(postponedFile);
+ r4eAssert.assertEquals(fFile1Name, postponedFile.getName());
+ r4eAssert.assertEquals(fFile1VersionID, postponedFile.getTargetFileVersion().getVersionID());
+ r4eAssert.setTest("Postponed Anomaly 1");
fPostponedAnomaly1 = (R4EUIPostponedAnomaly) postponedFile.getChildren()[0];
- Assert.assertNotNull(fPostponedAnomaly1);
- Assert.assertEquals(fOriginalAnomaly1Title, fPostponedAnomaly1.getAnomaly().getTitle());
- Assert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fPostponedAnomaly1.getAnomaly().getState());
- Assert.assertEquals(fOriginalReview.getReview().getName(),
+ r4eAssert.assertNotNull(fPostponedAnomaly1);
+ r4eAssert.assertEquals(fOriginalAnomaly1Title, fPostponedAnomaly1.getAnomaly().getTitle());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fPostponedAnomaly1.getAnomaly().getState());
+ r4eAssert.assertEquals(fOriginalReview.getReview().getName(),
fPostponedAnomaly1.getAnomaly().getInfoAtt().get(R4EUIConstants.POSTPONED_ATTR_ORIG_REVIEW_NAME));
+ r4eAssert.setTest("Postponed Anomaly 2");
fPostponedAnomaly2 = (R4EUIPostponedAnomaly) postponedFile.getChildren()[1];
- Assert.assertNotNull(fPostponedAnomaly2);
- Assert.assertEquals(fOriginalAnomaly2Title, fPostponedAnomaly2.getAnomaly().getTitle());
- Assert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fPostponedAnomaly2.getAnomaly().getState());
- Assert.assertEquals(fOriginalReview.getReview().getName(),
+ r4eAssert.assertNotNull(fPostponedAnomaly2);
+ r4eAssert.assertEquals(fOriginalAnomaly2Title, fPostponedAnomaly2.getAnomaly().getTitle());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fPostponedAnomaly2.getAnomaly().getState());
+ r4eAssert.assertEquals(fOriginalReview.getReview().getName(),
fPostponedAnomaly2.getAnomaly().getInfoAtt().get(R4EUIConstants.POSTPONED_ATTR_ORIG_REVIEW_NAME));
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(fPostponedAnomaly2.getParent().getChildren(),
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(fPostponedAnomaly2.getParent().getChildren(),
false, R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Change Postponed Anomaly State
+ // ------------------------------------------------------------------------
+
/**
* Method changePostponedAnomaliesState
*/
private void changePostponedAnomaliesState() {
- //Change postponed anomalies states to ASSIGNED
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("changePostponedAnomaliesState");
+
+ // Change postponed anomalies states to ASSIGNED
+ r4eAssert.setTest("Assign Postponed Anomaly");
fProxy.getCommandProxy().regressElement(fPostponedAnomaly1);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fPostponedAnomaly1.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fPostponedAnomaly1.getAnomaly().getState());
fProxy.getCommandProxy().regressElement(fPostponedAnomaly2);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fPostponedAnomaly2.getAnomaly().getState());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(fPostponedAnomaly2.getParent().getChildren(),
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fPostponedAnomaly2.getAnomaly().getState());
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(fPostponedAnomaly2.getParent().getChildren(),
false, R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
- //Verify that the original anomalies are also updated
+ // Verify that the original anomalies are also updated
+ r4eAssert.setTest("Verify Original Anomaly");
fProxy.getCommandProxy().openElement(fOriginalReview);
- Assert.assertTrue(fOriginalReview.isOpen());
- Assert.assertFalse(fTargetReview.isOpen());
+ r4eAssert.assertTrue(fOriginalReview.isOpen());
+ r4eAssert.assertFalse(fTargetReview.isOpen());
for (IR4EUIModelElement elem : fOriginalReview.getChildren()) {
if (elem.getName().equals(fOriginalItemName)) {
@@ -786,162 +868,237 @@ public class PostponedAnomaliesTests extends TestCase {
.getChildren()[1];
}
}
- Assert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fOriginalAnomaly1.getAnomaly().getState());
- Assert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fOriginalAnomaly2.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fOriginalAnomaly1.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fOriginalAnomaly2.getAnomaly().getState());
}
+ // ------------------------------------------------------------------------
+ // Change Original Anomaly State
+ // ------------------------------------------------------------------------
+
/**
* Method changeOriginalAnomaliesState
*/
private void changeOriginalAnomaliesState() {
- //Change original anomalies states back to POSTPONED
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("changeOriginalAnomaliesState");
+
+ // Change original anomalies states back to POSTPONED
+ r4eAssert.setTest("Postpone Anomaly");
fProxy.getAnomalyProxy().progressAnomaly(fOriginalAnomaly1, TestConstants.ANOMALY_STATE_POSTPONED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly1.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly1.getAnomaly().getState());
fProxy.getAnomalyProxy().progressAnomaly(fOriginalAnomaly2, TestConstants.ANOMALY_STATE_POSTPONED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly2.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly2.getAnomaly().getState());
- //Re-import of Target review and make sure the postponed anomalies are back
+ // Re-import of Target review and make sure the postponed anomalies are back
+ r4eAssert.setTest("Import Anomalies");
fProxy.getCommandProxy().openElement(fTargetReview);
- Assert.assertTrue(fTargetReview.isOpen());
- Assert.assertFalse(fOriginalReview.isOpen());
+ r4eAssert.assertTrue(fTargetReview.isOpen());
+ r4eAssert.assertFalse(fOriginalReview.isOpen());
importAnomalies();
}
+ // ------------------------------------------------------------------------
+ // Fix Postponed Anomaly
+ // ------------------------------------------------------------------------
+
/**
* Method fixPostponedAnomalies
*/
private void fixPostponedAnomalies() {
- //Set postponed anomalies state to FIXED
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("fixPostponedAnomalies");
+
+ // Set postponed anomalies state to FIXED
+ r4eAssert.setTest("Fix Anomaly");
fProxy.getCommandProxy().regressElement(fPostponedAnomaly1);
fProxy.getAnomalyProxy().progressAnomaly(fPostponedAnomaly1, TestConstants.ANOMALY_STATE_FIXED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fPostponedAnomaly1.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fPostponedAnomaly1.getAnomaly().getState());
fProxy.getCommandProxy().regressElement(fPostponedAnomaly2);
fProxy.getAnomalyProxy().progressAnomaly(fPostponedAnomaly2, TestConstants.ANOMALY_STATE_FIXED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fPostponedAnomaly2.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fPostponedAnomaly2.getAnomaly().getState());
- //Re-import anomalies and make sure they are disabled
+ // Re-import anomalies and make sure they are disabled
+ r4eAssert.setTest("Check Anomaly");
fProxy.getCommandProxy().importPostponedAnomalies(fTargetReview);
- Assert.assertEquals(0, fTargetReview.getPostponedContainer().getChildren().length);
+ r4eAssert.assertEquals(0, fTargetReview.getPostponedContainer().getChildren().length);
}
+ // ------------------------------------------------------------------------
+ // Create Original Global Postponed Anomaly
+ // ------------------------------------------------------------------------
+
/**
* Method createOriginalGlobalPostponedAnomalies
*/
private void createOriginalGlobalPostponedAnomalies() {
- //Anomaly1
- R4EUIAnomalyContainer cont1 = fOriginalReview.getAnomalyContainer();
- R4EUIAnomalyContainer cont2 = R4EUIModelController.getActiveReview().getAnomalyContainer();
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createOriginalGlobalPostponedAnomalies");
+
+ // Anomaly1
+ r4eAssert.setTest("Create Global Anomaly");
+// R4EUIAnomalyContainer cont1 = fOriginalReview.getAnomalyContainer();
+// R4EUIAnomalyContainer cont2 = R4EUIModelController.getActiveReview().getAnomalyContainer();
fOriginalGlobalAnomaly = fProxy.getAnomalyProxy().createGlobalAnomaly(fOriginalReview.getAnomalyContainer(),
ORIGINAL_GLOBAL_ANOMALY_TEST_TITLE, ORIGINAL_GLOBAL_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR,
TestConstants.ANOMALY_TEST_DUE_DATE, null, TestConstants.PARTICIPANT_ASSIGN_TO);
- Assert.assertNotNull(fOriginalGlobalAnomaly);
- Assert.assertEquals(ORIGINAL_GLOBAL_ANOMALY_TEST_TITLE, fOriginalGlobalAnomaly.getAnomaly().getTitle());
- Assert.assertEquals(ORIGINAL_GLOBAL_ANOMALY_TEST_DESCRIPTION, fOriginalGlobalAnomaly.getAnomaly()
+ r4eAssert.assertNotNull(fOriginalGlobalAnomaly);
+ r4eAssert.assertEquals(ORIGINAL_GLOBAL_ANOMALY_TEST_TITLE, fOriginalGlobalAnomaly.getAnomaly().getTitle());
+ r4eAssert.assertEquals(ORIGINAL_GLOBAL_ANOMALY_TEST_DESCRIPTION, fOriginalGlobalAnomaly.getAnomaly()
.getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
((R4ECommentType) fOriginalGlobalAnomaly.getAnomaly().getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fOriginalGlobalAnomaly.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fOriginalGlobalAnomaly.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fOriginalGlobalAnomaly.getAnomaly()
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fOriginalGlobalAnomaly.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fOriginalGlobalAnomaly.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fOriginalGlobalAnomaly.getAnomaly()
.getAssignedTo()
.get(0));
fProxy.getAnomalyProxy().progressAnomaly(fOriginalGlobalAnomaly, TestConstants.ANOMALY_STATE_POSTPONED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalGlobalAnomaly.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalGlobalAnomaly.getAnomaly().getState());
fOriginalGlobalAnomalyTitle = fOriginalGlobalAnomaly.getAnomaly().getTitle();
}
+ // ------------------------------------------------------------------------
+ // Create Global Target Review
+ // ------------------------------------------------------------------------
+
/**
* Method createGlobalTargetReview
*/
private void createGlobalTargetReview() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createGlobalTargetReview");
+
+ r4eAssert.setTest("Create Review");
fGlobalTargetReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TARGET_GLOBAL_REVIEW_TEST_NAME, TARGET_GLOBAL_REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
TestConstants.REVIEW_TEST_OBJECTIVES, TestConstants.REVIEW_TEST_REFERENCE_MATERIALS);
- Assert.assertNotNull(fGlobalTargetReview);
- Assert.assertNotNull(fGlobalTargetReview.getParticipantContainer());
- Assert.assertNotNull(fGlobalTargetReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fGlobalTargetReview.getReview().getType());
- Assert.assertEquals(TARGET_GLOBAL_REVIEW_TEST_NAME, fGlobalTargetReview.getReview().getName());
- Assert.assertEquals(TARGET_GLOBAL_REVIEW_TEST_DESCRIPTION, fGlobalTargetReview.getReview().getExtraNotes());
- Assert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fGlobalTargetReview.getReview().getProject());
+ r4eAssert.assertNotNull(fGlobalTargetReview);
+ r4eAssert.assertNotNull(fGlobalTargetReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fGlobalTargetReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fGlobalTargetReview.getReview().getType());
+ r4eAssert.assertEquals(TARGET_GLOBAL_REVIEW_TEST_NAME, fGlobalTargetReview.getReview().getName());
+ r4eAssert.assertEquals(TARGET_GLOBAL_REVIEW_TEST_DESCRIPTION, fGlobalTargetReview.getReview().getExtraNotes());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fGlobalTargetReview.getReview().getProject());
for (int i = 0; i < TestConstants.REVIEW_TEST_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fGlobalTargetReview.getReview()
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fGlobalTargetReview.getReview()
.getComponents()
.get(i));
}
- Assert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fGlobalTargetReview.getReview()
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fGlobalTargetReview.getReview()
.getEntryCriteria());
- Assert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fGlobalTargetReview.getReview().getObjectives());
- Assert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fGlobalTargetReview.getReview()
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fGlobalTargetReview.getReview().getObjectives());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fGlobalTargetReview.getReview()
.getReferenceMaterial());
- Assert.assertTrue(fGlobalTargetReview.isOpen());
+ r4eAssert.assertTrue(fGlobalTargetReview.isOpen());
}
+ // ------------------------------------------------------------------------
+ // Import Global Anomaly
+ // ------------------------------------------------------------------------
+
/**
* Method importGlobalAnomalies
*/
private void importGlobalAnomalies() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("importGlobalAnomalies");
+
+ r4eAssert.setTest("Import Postponed Anomaly");
fProxy.getCommandProxy().importPostponedAnomalies(fGlobalTargetReview);
- //Verify that the global postponed anomalies were correctly imported
+ // Verify that the global postponed anomalies were correctly imported
R4EUIPostponedContainer postponedContainer = fGlobalTargetReview.getPostponedContainer();
- Assert.assertNotNull(postponedContainer);
+ r4eAssert.assertNotNull(postponedContainer);
+ r4eAssert.setTest("Check Anomaly");
fGlobalPostponedAnomaly = (R4EUIPostponedAnomaly) postponedContainer.getAnomalyContainer().getChildren()[0];
- Assert.assertEquals(fOriginalReview.getReview().getName(), fGlobalPostponedAnomaly.getOriginalReviewName());
- Assert.assertNotNull(fGlobalPostponedAnomaly);
- Assert.assertEquals(fOriginalGlobalAnomalyTitle, fGlobalPostponedAnomaly.getAnomaly().getTitle());
- Assert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fGlobalPostponedAnomaly.getAnomaly().getState());
+ r4eAssert.assertEquals(fOriginalReview.getReview().getName(), fGlobalPostponedAnomaly.getOriginalReviewName());
+ r4eAssert.assertNotNull(fGlobalPostponedAnomaly);
+ r4eAssert.assertEquals(fOriginalGlobalAnomalyTitle, fGlobalPostponedAnomaly.getAnomaly().getTitle());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fGlobalPostponedAnomaly.getAnomaly().getState());
}
+ // ------------------------------------------------------------------------
+ // Change Global Postponed Anomaly State
+ // ------------------------------------------------------------------------
+
/**
* Method changeGlobalPostponedAnomaliesState
*/
private void changeGlobalPostponedAnomaliesState() {
- //Change postponed global anomaly states to ASSIGNED
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("changeGlobalPostponedAnomaliesState");
+
+ // Change postponed global anomaly states to ASSIGNED
+ r4eAssert.setTest("Change Postponed Anomaly");
fProxy.getCommandProxy().regressElement(fGlobalPostponedAnomaly);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fGlobalPostponedAnomaly.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fGlobalPostponedAnomaly.getAnomaly().getState());
- //Verify that the original global anomaly is also updated
+ // Verify that the original global anomaly is also updated
+ r4eAssert.setTest("Verify Anomaly");
fProxy.getCommandProxy().openElement(fOriginalReview);
- Assert.assertTrue(fOriginalReview.isOpen());
- Assert.assertFalse(fGlobalTargetReview.isOpen());
+ r4eAssert.assertTrue(fOriginalReview.isOpen());
+ r4eAssert.assertFalse(fGlobalTargetReview.isOpen());
fOriginalGlobalAnomaly = (R4EUIAnomalyBasic) fOriginalReview.getAnomalyContainer().getChildren()[0];
- Assert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fOriginalGlobalAnomaly.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fOriginalGlobalAnomaly.getAnomaly().getState());
}
+ // ------------------------------------------------------------------------
+ // Change Global Postponed Anomaly State
+ // ------------------------------------------------------------------------
+
/**
* Method changeOriginalGlobalAnomaliesState
*/
private void changeOriginalGlobalAnomaliesState() {
- //Change original global anomaly states back to POSTPONED
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("changeOriginalGlobalAnomaliesState");
+
+ // Change original global anomaly states back to POSTPONED
+ r4eAssert.setTest("Change Global Anomaly");
fProxy.getAnomalyProxy().progressAnomaly(fOriginalGlobalAnomaly, TestConstants.ANOMALY_STATE_POSTPONED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalGlobalAnomaly.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalGlobalAnomaly.getAnomaly().getState());
- //Re-import of Target review and make sure the postponed anomalies are back
+ // Re-import of Target review and make sure the postponed anomalies are back
+ r4eAssert.setTest("Verify Anomaly");
fProxy.getCommandProxy().openElement(fGlobalTargetReview);
- Assert.assertTrue(fGlobalTargetReview.isOpen());
- Assert.assertFalse(fOriginalReview.isOpen());
+ r4eAssert.assertTrue(fGlobalTargetReview.isOpen());
+ r4eAssert.assertFalse(fOriginalReview.isOpen());
importGlobalAnomalies();
}
+ // ------------------------------------------------------------------------
+ // Fix Global Postponed Anomaly State
+ // ------------------------------------------------------------------------
+
/**
* Method fixGlobalPostponedAnomalies
*/
private void fixGlobalPostponedAnomalies() {
- //Set postponed global anomaly state to FIXED
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("fixGlobalPostponedAnomalies");
+
+ // Set postponed global anomaly state to FIXED
+ r4eAssert.setTest("Change Global Anomaly");
fProxy.getCommandProxy().regressElement(fGlobalPostponedAnomaly);
fProxy.getAnomalyProxy().progressAnomaly(fGlobalPostponedAnomaly, TestConstants.ANOMALY_STATE_FIXED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fGlobalPostponedAnomaly.getAnomaly().getState());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fGlobalPostponedAnomaly.getAnomaly().getState());
- //Re-import anomalies and make sure they are disabled
+ // Re-import anomalies and make sure they are disabled
+ r4eAssert.setTest("Verify Anomaly");
fProxy.getCommandProxy().importPostponedAnomalies(fGlobalTargetReview);
- Assert.assertEquals(0, fGlobalTargetReview.getPostponedContainer().getChildren().length);
+ r4eAssert.assertEquals(0, fGlobalTargetReview.getPostponedContainer().getChildren().length);
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java
index 4c9f31c..57dbc22 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java
@@ -12,14 +12,13 @@
*
* Contributors:
* Sebastien Dubois - Initial Contribution for Mylyn Review R4E project
- *
+ * Francois Chouinard - Add identifying message to each assert
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.feature;
import java.io.File;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -30,12 +29,13 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewBasic;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewGroup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
import org.junit.Before;
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class PreferencesTests extends TestCase {
// ------------------------------------------------------------------------
@@ -67,7 +67,7 @@ public class PreferencesTests extends TestCase {
private R4EUIReviewBasic fReview = null;
// ------------------------------------------------------------------------
- // Methods
+ // Housekeeping
// ------------------------------------------------------------------------
/**
@@ -87,8 +87,8 @@ public class PreferencesTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
fProxy = R4EUITestMain.getInstance();
createReviewGroups();
@@ -100,12 +100,16 @@ public class PreferencesTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fProxy = null;
}
+ // ------------------------------------------------------------------------
+ // Main test case
+ // ------------------------------------------------------------------------
+
/**
* Method testPreferences
*/
@@ -116,15 +120,23 @@ public class PreferencesTests extends TestCase {
removeParentGroupFromPreferences();
}
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroups
*/
private void createReviewGroups() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewGroups");
+
fParentGroup = null;
fNonParentGroup = null;
- //Create Parent Review Group
+ // Create Parent Review Group
+ r4eAssert.setTest("Create Review Group");
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(PARENT_REVIEW_GROUP_NAME)) {
fParentGroup = group;
@@ -135,14 +147,15 @@ public class PreferencesTests extends TestCase {
fParentGroup = fProxy.getReviewGroupProxy().createReviewGroup(
TestUtils.FSharedFolder + File.separator + PARENT_REVIEW_GROUP_NAME, PARENT_REVIEW_GROUP_NAME,
PARENT_REVIEW_GROUP_DESCRIPTION, "", new String[0], new String[0], new String[0]);
- Assert.assertNotNull(fParentGroup);
- Assert.assertEquals(PARENT_REVIEW_GROUP_NAME, fParentGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/" + PARENT_REVIEW_GROUP_NAME,
- fParentGroup.getReviewGroup().getFolder());
- Assert.assertEquals(PARENT_REVIEW_GROUP_DESCRIPTION, fParentGroup.getReviewGroup().getDescription());
+ r4eAssert.assertNotNull(fParentGroup);
+ r4eAssert.assertEquals(PARENT_REVIEW_GROUP_NAME, fParentGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ + PARENT_REVIEW_GROUP_NAME, fParentGroup.getReviewGroup().getFolder());
+ r4eAssert.assertEquals(PARENT_REVIEW_GROUP_DESCRIPTION, fParentGroup.getReviewGroup().getDescription());
}
- //Create Non-Parent Review Group
+ // Create Non-Parent Review Group
+ r4eAssert.setTest("Create Non-Parent Review Group");
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(NONPARENT_REVIEW_GROUP_NAME)) {
fNonParentGroup = group;
@@ -154,11 +167,12 @@ public class PreferencesTests extends TestCase {
TestUtils.FSharedFolder + File.separator + NONPARENT_REVIEW_GROUP_NAME,
NONPARENT_REVIEW_GROUP_NAME, NONPARENT_REVIEW_GROUP_DESCRIPTION, "", new String[0], new String[0],
new String[0]);
- Assert.assertNotNull(fNonParentGroup);
- Assert.assertEquals(NONPARENT_REVIEW_GROUP_NAME, fNonParentGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertNotNull(fNonParentGroup);
+ r4eAssert.assertEquals(NONPARENT_REVIEW_GROUP_NAME, fNonParentGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ NONPARENT_REVIEW_GROUP_NAME, fNonParentGroup.getReviewGroup().getFolder());
- Assert.assertEquals(NONPARENT_REVIEW_GROUP_DESCRIPTION, fNonParentGroup.getReviewGroup().getDescription());
+ r4eAssert.assertEquals(NONPARENT_REVIEW_GROUP_DESCRIPTION, fNonParentGroup.getReviewGroup()
+ .getDescription());
}
}
@@ -166,30 +180,53 @@ public class PreferencesTests extends TestCase {
* Method createReview
*/
private void createReview() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReview");
+ r4eAssert.setTest("Create Review");
+
fReview = fProxy.getReviewProxy().createReview(fParentGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
REVIEW_TEST_NAME, REVIEW_TEST_DESCRIPTION, null, null, new String[0], null, null, null);
- Assert.assertNotNull(fReview);
- Assert.assertNotNull(fReview.getParticipantContainer());
- Assert.assertNotNull(fReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
- Assert.assertEquals(REVIEW_TEST_NAME, fReview.getReview().getName());
- Assert.assertEquals(REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertNotNull(fReview);
+ r4eAssert.assertNotNull(fReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
+ r4eAssert.assertEquals(REVIEW_TEST_NAME, fReview.getReview().getName());
+ r4eAssert.assertEquals(REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
+ r4eAssert.assertTrue(fReview.isOpen());
}
+ // ------------------------------------------------------------------------
+ // Set review tree table
+ // ------------------------------------------------------------------------
+
/**
* Method setReviewTreeTableDisplay
*/
private void setReviewTreeTableDisplay() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("setReviewTreeTableDisplay");
+ r4eAssert.setTest("Change Display");
+
fProxy.getCommandProxy().changeDisplay();
- Assert.assertFalse(R4EUIModelController.getNavigatorView().isDefaultDisplay());
+ r4eAssert.assertFalse(R4EUIModelController.getNavigatorView().isDefaultDisplay());
}
+ // ------------------------------------------------------------------------
+ // Remove non-parent group tests
+ // ------------------------------------------------------------------------
+
/**
* Method removeNonParentGroupFromPreferences
*/
private void removeNonParentGroupFromPreferences() {
- //Remove Review Group from preferences
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("removeNonParentGroupFromPreferences");
+
+ // Remove Review Group from preferences
+ r4eAssert.setTest("Remove Review Group");
String prefsGroup = fNonParentGroup.getReviewGroup().eResource().getURI().toFileString();
fProxy.getPreferencesProxy().removeGroupFromPreferences(prefsGroup);
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
@@ -197,14 +234,23 @@ public class PreferencesTests extends TestCase {
fail("Group " + prefsGroup + " should not be present since it was removed from preferences");
}
}
- Assert.assertFalse(R4EUIModelController.getNavigatorView().isDefaultDisplay());
+ r4eAssert.assertFalse(R4EUIModelController.getNavigatorView().isDefaultDisplay());
}
+ // ------------------------------------------------------------------------
+ // Remove parent group tests
+ // ------------------------------------------------------------------------
+
/**
- * Method createOriginalPostponedAnomalies
+ * Method removeParentGroupFromPreferences
*/
private void removeParentGroupFromPreferences() {
- //Remove Review Group from preferences
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("removeParentGroupFromPreferences");
+
+ // Remove Review Group from preferences
+ r4eAssert.setTest("Remove Review Group");
String prefsGroup = fParentGroup.getReviewGroup().eResource().getURI().toFileString();
fProxy.getPreferencesProxy().removeGroupFromPreferences(prefsGroup);
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
@@ -212,7 +258,7 @@ public class PreferencesTests extends TestCase {
fail("Group " + prefsGroup + " should not be present since it was removed from preferences");
}
}
- Assert.assertTrue(R4EUIModelController.getNavigatorView().isDefaultDisplay());
+ r4eAssert.assertTrue(R4EUIModelController.getNavigatorView().isDefaultDisplay());
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithSrangeCharTest.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithStrangeCharTest.java
index 7dd8843..a83f897 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithSrangeCharTest.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithStrangeCharTest.java
@@ -13,14 +13,13 @@
*
* Contributors:
* Jacques Bouthillier - Created for Mylyn Review R4E project
- *
+ * Francois Chouinard - Add identifying message to each assert
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.feature;
import java.io.File;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -33,6 +32,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewGroup;
import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorActionGroup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
@@ -42,12 +42,8 @@ import org.junit.Before;
* @author Jacques Bouthillier
* @version $Revision: 1.0 $
*/
-@SuppressWarnings("restriction")
-public class ReviewWithSrangeCharTest extends TestCase {
-
- // ------------------------------------------------------------------------
- // Constant
- // ------------------------------------------------------------------------
+@SuppressWarnings({ "restriction", "nls" })
+public class ReviewWithStrangeCharTest extends TestCase {
// ------------------------------------------------------------------------
// Member variables
@@ -60,7 +56,7 @@ public class ReviewWithSrangeCharTest extends TestCase {
private R4EUIReviewBasic fReview = null;
// ------------------------------------------------------------------------
- // Methods
+ // Housekeeping
// ------------------------------------------------------------------------
/**
@@ -70,7 +66,7 @@ public class ReviewWithSrangeCharTest extends TestCase {
*/
public static Test suite() {
TestSuite suite = new TestSuite();
- suite.addTestSuite(ReviewWithSrangeCharTest.class);
+ suite.addTestSuite(ReviewWithStrangeCharTest.class);
return new R4ETestSetup(suite);
}
@@ -80,8 +76,8 @@ public class ReviewWithSrangeCharTest extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
fProxy = R4EUITestMain.getInstance();
createReviewGroups();
@@ -96,12 +92,16 @@ public class ReviewWithSrangeCharTest extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fProxy = null;
}
+ // ------------------------------------------------------------------------
+ // Main test case (pretty light...)
+ // ------------------------------------------------------------------------
+
/**
* Method testUseStrangeCharInGroupReview
*
@@ -111,14 +111,22 @@ public class ReviewWithSrangeCharTest extends TestCase {
TestUtils.waitForJobs();
}
+ // ------------------------------------------------------------------------
+ // helper functions
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroups
*/
private void createReviewGroups() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewGroups");
+
fGroup = null;
- //Create Review Group
+ // Create Review Group
+ r4eAssert.setTest("Create Review Group");
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE)) {
fGroup = group;
@@ -132,20 +140,21 @@ public class ReviewWithSrangeCharTest extends TestCase {
TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
- Assert.assertNotNull(fGroup);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE, fGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/" //$NON-NLS-1$
+ r4eAssert.assertNotNull(fGroup);
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE, fGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/" //$NON-NLS-1$
+ TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE, fGroup.getReviewGroup().getFolder());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup().getDescription());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
+ .getDescription());
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
.getDefaultEntryCriteria());
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
.getAvailableProjects()
.get(i));
}
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
.getAvailableComponents()
.get(i));
}
@@ -158,30 +167,36 @@ public class ReviewWithSrangeCharTest extends TestCase {
*/
private void createReviews() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviews");
+
+ r4eAssert.setTest("Open Review Group");
if (!fGroup.isOpen()) {
fProxy.getCommandProxy().openElement(fGroup);
}
- Assert.assertTrue(fGroup.isOpen());
+ r4eAssert.assertTrue(fGroup.isOpen());
+ r4eAssert.setTest("Create Review");
fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TestConstants.REVIEW_STRANGE_NAME_INF, TestConstants.REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
TestConstants.REVIEW_TEST_OBJECTIVES, TestConstants.REVIEW_TEST_REFERENCE_MATERIALS);
- Assert.assertNotNull(fReview);
- Assert.assertNotNull(fReview.getParticipantContainer());
- Assert.assertNotNull(fReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
- Assert.assertEquals(TestConstants.REVIEW_STRANGE_NAME_INF, fReview.getReview().getName());
- Assert.assertEquals(TestConstants.REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
- Assert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
+ r4eAssert.assertNotNull(fReview);
+ r4eAssert.assertNotNull(fReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
+ r4eAssert.assertEquals(TestConstants.REVIEW_STRANGE_NAME_INF, fReview.getReview().getName());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
for (int i = 0; i < TestConstants.REVIEW_TEST_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
}
- Assert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
- Assert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
- Assert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview().getReferenceMaterial());
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview()
+ .getReferenceMaterial());
+ r4eAssert.assertTrue(fReview.isOpen());
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java
index 7809041..f133425 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java
@@ -12,7 +12,7 @@
*
* Contributors:
* Sebastien Dubois - Initial Contribution for Mylyn Review R4E project
- *
+ * Francois Chouinard - Add identifying message to each assert
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.feature;
@@ -21,7 +21,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -42,12 +41,13 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorAction
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
import org.junit.Before;
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class UserReviewedTests extends TestCase {
// ------------------------------------------------------------------------
@@ -87,7 +87,7 @@ public class UserReviewedTests extends TestCase {
private String fItemName2 = null;
// ------------------------------------------------------------------------
- // Methods
+ // Housekeeping
// ------------------------------------------------------------------------
/**
@@ -107,8 +107,8 @@ public class UserReviewedTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
fProxy = R4EUITestMain.getInstance();
createReviewGroups();
@@ -125,14 +125,18 @@ public class UserReviewedTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fProxy = null;
}
+ // ------------------------------------------------------------------------
+ // Main test case
+ // ------------------------------------------------------------------------
+
/**
- * Method testPreferences
+ * Method testUserReviewed
*
* @throws CoreException
*/
@@ -149,14 +153,22 @@ public class UserReviewedTests extends TestCase {
unsetFile();
}
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroups
*/
private void createReviewGroups() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewGroups");
+
fReviewGroup = null;
- //Create Parent Review Group
+ // Create Parent Review Group
+ r4eAssert.setTest("Create Review Group");
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(PARENT_REVIEW_GROUP_NAME)) {
fReviewGroup = group;
@@ -167,11 +179,11 @@ public class UserReviewedTests extends TestCase {
fReviewGroup = fProxy.getReviewGroupProxy().createReviewGroup(
TestUtils.FSharedFolder + File.separator + PARENT_REVIEW_GROUP_NAME, PARENT_REVIEW_GROUP_NAME,
PARENT_REVIEW_GROUP_DESCRIPTION, "", new String[0], new String[0], new String[0]);
- Assert.assertNotNull(fReviewGroup);
- Assert.assertEquals(PARENT_REVIEW_GROUP_NAME, fReviewGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/" + PARENT_REVIEW_GROUP_NAME,
- fReviewGroup.getReviewGroup().getFolder());
- Assert.assertEquals(PARENT_REVIEW_GROUP_DESCRIPTION, fReviewGroup.getReviewGroup().getDescription());
+ r4eAssert.assertNotNull(fReviewGroup);
+ r4eAssert.assertEquals(PARENT_REVIEW_GROUP_NAME, fReviewGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ + PARENT_REVIEW_GROUP_NAME, fReviewGroup.getReviewGroup().getFolder());
+ r4eAssert.assertEquals(PARENT_REVIEW_GROUP_DESCRIPTION, fReviewGroup.getReviewGroup().getDescription());
}
}
@@ -179,21 +191,31 @@ public class UserReviewedTests extends TestCase {
* Method createReview
*/
private void createReview() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReview");
+
+ r4eAssert.setTest("Create Review");
fReview = fProxy.getReviewProxy().createReview(fReviewGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
REVIEW_TEST_NAME, REVIEW_TEST_DESCRIPTION, null, null, new String[0], null, null, null);
- Assert.assertNotNull(fReview);
- Assert.assertNotNull(fReview.getParticipantContainer());
- Assert.assertNotNull(fReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
- Assert.assertEquals(REVIEW_TEST_NAME, fReview.getReview().getName());
- Assert.assertEquals(REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertNotNull(fReview);
+ r4eAssert.assertNotNull(fReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
+ r4eAssert.assertEquals(REVIEW_TEST_NAME, fReview.getReview().getName());
+ r4eAssert.assertEquals(REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
+ r4eAssert.assertTrue(fReview.isOpen());
}
/**
* Method createReviewItems
*/
private void createReviewItems() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewItems");
+
+ r4eAssert.setTest("Create Commit Item");
fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
fItem2 = fProxy.getItemProxy().createCommitItem(TestUtils.FCIProject, 0);
fItemName = fItem.getName();
@@ -210,31 +232,45 @@ public class UserReviewedTests extends TestCase {
}
}
- //Now validate
- Assert.assertNotNull(fItem);
- Assert.assertNotNull(fItem2);
+ // Now validate
+ r4eAssert.assertNotNull(fItem);
+ r4eAssert.assertNotNull(fItem2);
}
/**
* Method createParticipants
*/
private void createParticipants() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createParticipants");
+
+ r4eAssert.setTest("Create Participant");
List<R4EParticipant> participants = new ArrayList<R4EParticipant>(1);
R4EParticipant participant = RModelFactory.eINSTANCE.createR4EParticipant();
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
participants.add(participant);
fParticipant = fProxy.getParticipantProxy().createParticipant(fReview.getParticipantContainer(), participants);
- Assert.assertNotNull(fParticipant);
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId());
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail());
+ r4eAssert.assertNotNull(fParticipant);
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail());
}
+ // ------------------------------------------------------------------------
+ // Set Delta tests
+ // ------------------------------------------------------------------------
+
/**
* Method setDelta
*/
+ @SuppressWarnings("null")
private void setDelta() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("setDelta");
+
+ r4eAssert.setTest("Get File");
R4EUIFileContext file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
@@ -242,9 +278,10 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
+ r4eAssert.assertNotNull(file);
- //Mark first delta as reviewed
+ // Mark first delta as reviewed
+ r4eAssert.setTest("Mark Delta");
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
if (delta.getName().equals(DELTA1_NAME)) {
fProxy.getCommandProxy().changeReviewedState(delta);
@@ -253,10 +290,11 @@ public class UserReviewedTests extends TestCase {
}
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertTrue(fReview.isOpen());
+ r4eAssert.setTest("Check Review Item");
fItem = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName)) {
@@ -264,7 +302,7 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(fItem);
+ r4eAssert.assertNotNull(fItem);
file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
@@ -272,24 +310,34 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
- Assert.assertFalse(fReview.isUserReviewed());
- Assert.assertFalse(fItem.isUserReviewed());
- Assert.assertFalse(file.isUserReviewed());
+ r4eAssert.assertNotNull(file);
+ r4eAssert.assertFalse(fReview.isUserReviewed());
+ r4eAssert.assertFalse(fItem.isUserReviewed());
+ r4eAssert.assertFalse(file.isUserReviewed());
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
if (delta.getName().equals(DELTA1_NAME)) {
- Assert.assertTrue(delta.isUserReviewed());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(delta, true,
+ r4eAssert.assertTrue(delta.isUserReviewed());
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(delta, true,
R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
break;
}
}
}
+ // ------------------------------------------------------------------------
+ // Set All Delta tests
+ // ------------------------------------------------------------------------
+
/**
* Method setAllDeltas
*/
+ @SuppressWarnings("null")
private void setAllDeltas() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("setAllDeltas");
+
+ r4eAssert.setTest("Get File");
R4EUIFileContext file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
@@ -297,9 +345,10 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
+ r4eAssert.assertNotNull(file);
- //Mark remaining deltas as reviewed
+ // Mark remaining deltas as reviewed
+ r4eAssert.setTest("Marks Deltas As Reviewed");
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
//Skip already marked delta
if (delta.getName().equals(DELTA1_NAME)) {
@@ -309,10 +358,11 @@ public class UserReviewedTests extends TestCase {
}
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertTrue(fReview.isOpen());
+ r4eAssert.setTest("Check Review Items");
fItem = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName)) {
@@ -320,7 +370,7 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(fItem);
+ r4eAssert.assertNotNull(fItem);
file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
@@ -328,22 +378,31 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
- Assert.assertFalse(fReview.isUserReviewed());
- Assert.assertFalse(fItem.isUserReviewed());
- Assert.assertTrue(file.isUserReviewed());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(file.getContentsContainerElement().getChildren(),
- true, R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
+ r4eAssert.assertNotNull(file);
+ r4eAssert.assertFalse(fReview.isUserReviewed());
+ r4eAssert.assertFalse(fItem.isUserReviewed());
+ r4eAssert.assertTrue(file.isUserReviewed());
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ file.getContentsContainerElement().getChildren(), true, R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
- Assert.assertTrue(delta.isUserReviewed());
+ r4eAssert.assertTrue(delta.isUserReviewed());
}
}
+ // ------------------------------------------------------------------------
+ // Set File tests
+ // ------------------------------------------------------------------------
+
/**
* Method setFile
*/
+ @SuppressWarnings("null")
private void setFile() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("setFile");
+
+ r4eAssert.setTest("Get File");
R4EUIFileContext file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE2_PROJ_NAME)) {
@@ -351,16 +410,18 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
+ r4eAssert.assertNotNull(file);
- //Mark file as reviewed
+ // Mark file as reviewed
+ r4eAssert.setTest("Mark File as Reviewed");
fProxy.getCommandProxy().changeReviewedState(file);
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertTrue(fReview.isOpen());
+ r4eAssert.setTest("Check File");
fItem = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName)) {
@@ -368,7 +429,7 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(fItem);
+ r4eAssert.assertNotNull(fItem);
file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE2_PROJ_NAME)) {
@@ -376,10 +437,10 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
- Assert.assertFalse(fReview.isUserReviewed());
- Assert.assertFalse(fItem.isUserReviewed());
- Assert.assertTrue(file.isUserReviewed());
+ r4eAssert.assertNotNull(file);
+ r4eAssert.assertFalse(fReview.isUserReviewed());
+ r4eAssert.assertFalse(fItem.isUserReviewed());
+ r4eAssert.assertTrue(file.isUserReviewed());
file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
@@ -387,18 +448,27 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertTrue(file.isUserReviewed());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(file.getContentsContainerElement().getChildren(),
- true, R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
+ r4eAssert.assertTrue(file.isUserReviewed());
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ file.getContentsContainerElement().getChildren(), true, R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
- Assert.assertTrue(delta.isUserReviewed());
+ r4eAssert.assertTrue(delta.isUserReviewed());
}
}
+ // ------------------------------------------------------------------------
+ // Set All Files tests
+ // ------------------------------------------------------------------------
+
/**
* Method setAllFiles
*/
private void setAllFiles() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("setAllFiles");
+
+ r4eAssert.setTest("Mark All Files as Reviewed");
for (IR4EUIModelElement file : fItem.getChildren()) {
if (file.getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)
|| file.getName().equals(TestUtils.JAVA_FILE2_PROJ_NAME)) {
@@ -408,10 +478,11 @@ public class UserReviewedTests extends TestCase {
}
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertTrue(fReview.isOpen());
+ r4eAssert.setTest("Check Files");
fItem = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName)) {
@@ -419,21 +490,30 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(fItem);
- Assert.assertFalse(fReview.isUserReviewed());
- Assert.assertTrue(fItem.isUserReviewed());
+ r4eAssert.assertNotNull(fItem);
+ r4eAssert.assertFalse(fReview.isUserReviewed());
+ r4eAssert.assertTrue(fItem.isUserReviewed());
for (IR4EUIModelElement file : fItem.getChildren()) {
- Assert.assertTrue(file.isUserReviewed());
+ r4eAssert.assertTrue(file.isUserReviewed());
for (R4EUIContent delta : ((R4EUIFileContext) file).getContentsContainerElement().getContentsList()) {
- Assert.assertTrue(delta.isUserReviewed());
+ r4eAssert.assertTrue(delta.isUserReviewed());
}
}
}
+ // ------------------------------------------------------------------------
+ // Set Review Item tests
+ // ------------------------------------------------------------------------
+
/**
* Method setReviewItem
*/
private void setReviewItem() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("setReviewItem");
+
+ r4eAssert.setTest("Setup Review State");
fItem2 = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName2)) {
@@ -444,61 +524,84 @@ public class UserReviewedTests extends TestCase {
fProxy.getCommandProxy().changeReviewedState(fItem2);
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertTrue(fReview.isOpen());
- Assert.assertTrue(fReview.isUserReviewed());
+ r4eAssert.setTest("Check Review State");
+ r4eAssert.assertTrue(fReview.isUserReviewed());
for (IR4EUIModelElement item : fReview.getChildren()) {
if (item instanceof R4EUIReviewItem) {
- Assert.assertTrue(item.isUserReviewed());
+ r4eAssert.assertTrue(item.isUserReviewed());
for (IR4EUIModelElement file : item.getChildren()) {
- Assert.assertTrue(file.isUserReviewed());
+ r4eAssert.assertTrue(file.isUserReviewed());
for (R4EUIContent delta : ((R4EUIFileContext) file).getContentsContainerElement().getContentsList()) {
- Assert.assertTrue(delta.isUserReviewed());
+ r4eAssert.assertTrue(delta.isUserReviewed());
}
}
}
}
}
+ // ------------------------------------------------------------------------
+ // Add Review Item tests
+ // ------------------------------------------------------------------------
+
/**
* Method addReviewItemFromOtherUser
*
* @throws CoreException
*/
private void addReviewItemFromOtherUser() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("addReviewItemFromOtherUser");
+
+ r4eAssert.setTest("Close Element");
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
- //Change user
+ // Change user
+ r4eAssert.setTest("Change User");
String originalUser = fProxy.getPreferencesProxy().getUser();
String originalEmail = fProxy.getPreferencesProxy().getEmail();
fProxy.getPreferencesProxy().setUser(TestConstants.PARTICIPANT_TEST_ID);
fProxy.getPreferencesProxy().setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
- //New user adds new review item
+ // New user adds new review item
+ r4eAssert.setTest("New User Adds New Review Item");
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertTrue(fReview.isOpen());
fItem3 = fProxy.getItemProxy().createCommitItem(TestUtils.FTextIProject, 0);
- Assert.assertNotNull(fItem3);
+ r4eAssert.assertNotNull(fItem3);
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
- //Change back user to original one
+ // Change back user to original one
+ r4eAssert.setTest("Change back to Original User");
fProxy.getPreferencesProxy().setUser(originalUser);
fProxy.getPreferencesProxy().setEmail(originalEmail);
- //Verify Reviewed State
+ // Verify Reviewed State
+ r4eAssert.setTest("Verify State");
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
- Assert.assertFalse(fReview.isUserReviewed());
+ r4eAssert.assertTrue(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isUserReviewed());
}
+ // ------------------------------------------------------------------------
+ // Unset Delta tests
+ // ------------------------------------------------------------------------
+
/**
* Method unsetDelta
*/
+ @SuppressWarnings("null")
private void unsetDelta() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("unsetDelta");
+
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
fProxy.getCommandProxy().toggleHideDeltasFilter();
}
@@ -510,6 +613,7 @@ public class UserReviewedTests extends TestCase {
}
}
+ r4eAssert.setTest("Get File");
R4EUIFileContext file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
@@ -517,9 +621,10 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
+ r4eAssert.assertNotNull(file);
- //Unmark first delta as reviewed
+ // Unmark first delta as reviewed
+ r4eAssert.setTest("Setup Review State");
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
if (delta.getName().equals(DELTA1_NAME)) {
fProxy.getCommandProxy().changeReviewedState(delta);
@@ -528,10 +633,11 @@ public class UserReviewedTests extends TestCase {
}
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertTrue(fReview.isOpen());
+ r4eAssert.setTest("Check Review State");
fItem = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName)) {
@@ -539,7 +645,7 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(fItem);
+ r4eAssert.assertNotNull(fItem);
file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
@@ -547,27 +653,36 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
+ r4eAssert.assertNotNull(file);
- Assert.assertFalse(fReview.isUserReviewed());
- Assert.assertFalse(fItem.isUserReviewed());
- Assert.assertFalse(file.isUserReviewed());
+ r4eAssert.assertFalse(fReview.isUserReviewed());
+ r4eAssert.assertFalse(fItem.isUserReviewed());
+ r4eAssert.assertFalse(file.isUserReviewed());
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
if (delta.getName().equals(DELTA1_NAME)) {
- Assert.assertFalse(delta.isUserReviewed());
- Assert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(delta, true,
+ r4eAssert.assertFalse(delta.isUserReviewed());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(delta, true,
R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(delta, true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(delta, true,
R4EUIConstants.DELTA_ANNOTATION_ID));
break;
}
}
}
+ // ------------------------------------------------------------------------
+ // Unset Review Item tests
+ // ------------------------------------------------------------------------
+
/**
* Method unsetReviewItem
*/
private void unsetReviewItem() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("unsetReviewItem");
+
+ r4eAssert.setTest("Setup Review State");
fItem2 = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName2)) {
@@ -576,14 +691,16 @@ public class UserReviewedTests extends TestCase {
}
}
fProxy.getCommandProxy().changeReviewedState(fItem2);
- Assert.assertFalse(fItem2.isUserReviewed());
+ r4eAssert.assertFalse(fItem2.isUserReviewed());
+ r4eAssert.setTest("Close/Open Review Element");
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertTrue(fReview.isOpen());
- Assert.assertFalse(fReview.isUserReviewed());
+ r4eAssert.setTest("Check Review State");
+ r4eAssert.assertFalse(fReview.isUserReviewed());
fItem2 = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName2)) {
@@ -592,17 +709,27 @@ public class UserReviewedTests extends TestCase {
}
}
for (IR4EUIModelElement file : fItem2.getChildren()) {
- Assert.assertFalse(file.isUserReviewed());
+ r4eAssert.assertFalse(file.isUserReviewed());
for (R4EUIContent delta : ((R4EUIFileContext) file).getContentsContainerElement().getContentsList()) {
- Assert.assertFalse(delta.isUserReviewed());
+ r4eAssert.assertFalse(delta.isUserReviewed());
}
}
}
+ // ------------------------------------------------------------------------
+ // Unset File tests
+ // ------------------------------------------------------------------------
+
/**
* Method unsetFile
*/
+ @SuppressWarnings("null")
private void unsetFile() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("unsetFile");
+
+ r4eAssert.setTest("Get File");
fItem = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName)) {
@@ -610,7 +737,7 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(fItem);
+ r4eAssert.assertNotNull(fItem);
R4EUIFileContext file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
@@ -619,16 +746,18 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
+ r4eAssert.assertNotNull(file);
- //Mark file as reviewed
+ // Mark file as reviewed
+ r4eAssert.setTest("Setup Review State");
fProxy.getCommandProxy().changeReviewedState(file);
fProxy.getCommandProxy().closeElement(fReview);
- Assert.assertFalse(fReview.isOpen());
+ r4eAssert.assertFalse(fReview.isOpen());
fProxy.getCommandProxy().openElement(fReview);
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertTrue(fReview.isOpen());
+ r4eAssert.setTest("Check Review State");
fItem = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName)) {
@@ -636,7 +765,7 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(fItem);
+ r4eAssert.assertNotNull(fItem);
file = null;
for (IR4EUIModelElement elem : fItem.getChildren()) {
if (elem.getName().equals(TestUtils.JAVA_FILE2_PROJ_NAME)) {
@@ -644,17 +773,17 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- Assert.assertNotNull(file);
+ r4eAssert.assertNotNull(file);
- Assert.assertFalse(fReview.isUserReviewed());
- Assert.assertFalse(fItem.isUserReviewed());
- Assert.assertFalse(file.isUserReviewed());
+ r4eAssert.assertFalse(fReview.isUserReviewed());
+ r4eAssert.assertFalse(fItem.isUserReviewed());
+ r4eAssert.assertFalse(file.isUserReviewed());
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
- Assert.assertFalse(delta.isUserReviewed());
- Assert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(delta, true,
+ r4eAssert.assertFalse(delta.isUserReviewed());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(delta, true,
R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
- Assert.assertTrue(fProxy.getCommandProxy()
- .verifyAnnotation(delta, true, R4EUIConstants.DELTA_ANNOTATION_ID));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(delta, true,
+ R4EUIConstants.DELTA_ANNOTATION_ID));
}
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestAnomaly.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestAnomaly.java
index 2def729..2ac9083 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestAnomaly.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestAnomaly.java
@@ -50,7 +50,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class R4EUITestAnomaly extends R4EUITestElement {
private static final String NEW_ANOMALY_COMMAND = "org.eclipse.mylyn.reviews.r4e.ui.commands.NewAnomaly";
@@ -559,6 +559,5 @@ public class R4EUITestAnomaly extends R4EUITestElement {
when(mockAnomalyDialog.open()).thenReturn(Window.OK);
fParentProxy.getCommandProxy().progressElement(aCompareEditorAnomaly, null);
-
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestItem.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestItem.java
index c47a2de..56166c0 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestItem.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestItem.java
@@ -51,7 +51,7 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.texteditor.ITextEditor;
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class R4EUITestItem extends R4EUITestElement {
public R4EUITestItem(R4EUITestMain aR4EUITestProxy) {
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestRule.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestRule.java
index 9cb9fac..876eb4e 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestRule.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestRule.java
@@ -64,6 +64,5 @@ public class R4EUITestRule extends R4EUITestElement {
when(mockRuleDialog.open()).thenReturn(Window.OK);
return (R4EUIRule) fParentProxy.getCommandProxy().runNewChildElement(aRuleViolation);
-
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java
index e4ae09b..1d76aa5 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java
@@ -12,7 +12,7 @@
*
* Contributors:
* Sebastien Dubois - Created for Mylyn Review R4E project
- *
+ * Francois Chouinard - Add identifying message to each assert
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.sanity;
@@ -21,7 +21,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -54,12 +53,13 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.sorters.ReviewTypeComparator;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
import org.junit.Before;
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class SanityBasicTests extends TestCase {
// ------------------------------------------------------------------------
@@ -93,7 +93,7 @@ public class SanityBasicTests extends TestCase {
private int fAnomalyFileIndex;
// ------------------------------------------------------------------------
- // Methods
+ // Housekeeping
// ------------------------------------------------------------------------
/**
@@ -113,8 +113,8 @@ public class SanityBasicTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
fProxy = R4EUITestMain.getInstance();
createReviewGroups();
@@ -128,12 +128,16 @@ public class SanityBasicTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fProxy = null;
}
+ // ------------------------------------------------------------------------
+ // Main test case
+ // ------------------------------------------------------------------------
+
/**
* Method testBasicReviews
*
@@ -153,14 +157,22 @@ public class SanityBasicTests extends TestCase {
sendQuestionNotifications();
}
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroups
*/
private void createReviewGroups() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewGroups");
+
fGroup = null;
- //Create Review Group
+ // Create Review Group
+ r4eAssert.setTest("Create Review Group");
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(TestConstants.REVIEW_GROUP_TEST_NAME)) {
fGroup = group;
@@ -174,20 +186,21 @@ public class SanityBasicTests extends TestCase {
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
- Assert.assertNotNull(fGroup);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertNotNull(fGroup);
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup().getDescription());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
+ .getDescription());
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
.getDefaultEntryCriteria());
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
.getAvailableProjects()
.get(i));
}
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
.getAvailableComponents()
.get(i));
}
@@ -195,11 +208,20 @@ public class SanityBasicTests extends TestCase {
}
}
+ // ------------------------------------------------------------------------
+ // Create Review Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createReviews
*/
private void createReviews() {
- //Update Review Group handle
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviews");
+
+ // Update Review Group Handle
+ r4eAssert.setTest("Update Review Group Handle");
for (IR4EUIModelElement elem : R4EUIModelController.getRootElement().getChildren()) {
if (fGroupName.equals(elem.getName())) {
fGroup = (R4EUIReviewGroup) elem;
@@ -208,36 +230,47 @@ public class SanityBasicTests extends TestCase {
if (!fGroup.isOpen()) {
fProxy.getCommandProxy().openElement(fGroup);
}
- Assert.assertTrue(fGroup.isOpen());
+ r4eAssert.assertTrue(fGroup.isOpen());
+ r4eAssert.setTest("Create Review");
fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_BASIC,
TestConstants.REVIEW_TEST_NAME, TestConstants.REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
TestConstants.REVIEW_TEST_OBJECTIVES, TestConstants.REVIEW_TEST_REFERENCE_MATERIALS);
- Assert.assertNotNull(fReview);
- Assert.assertNotNull(fReview.getParticipantContainer());
- Assert.assertNotNull(fReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_BASIC, fReview.getReview().getType());
- Assert.assertEquals(TestConstants.REVIEW_TEST_NAME, fReview.getReview().getName());
- Assert.assertEquals(TestConstants.REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
- Assert.assertEquals(TestConstants.REVIEW_TEST_DUE_DATE, fReview.getReview().getDueDate());
- Assert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
+ r4eAssert.assertNotNull(fReview);
+ r4eAssert.assertNotNull(fReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_BASIC, fReview.getReview().getType());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_NAME, fReview.getReview().getName());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_DUE_DATE, fReview.getReview().getDueDate());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
for (int i = 0; i < TestConstants.REVIEW_TEST_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
}
- Assert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
- Assert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
- Assert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview().getReferenceMaterial());
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview()
+ .getReferenceMaterial());
+ r4eAssert.assertTrue(fReview.isOpen());
}
+ // ------------------------------------------------------------------------
+ // Create Review Item Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewItems
*/
private void createReviewItems() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewItems");
+
+ // Close and re-open, so the validation takes de-serialized information
+ r4eAssert.setTest("Create Commit Item");
fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
- //close and re-open, so the validation takes de-serialized information
String itemName = fItem.getName();
fProxy.getCommandProxy().closeElement(fReview);
fProxy.getCommandProxy().openElement(fReview);
@@ -247,211 +280,239 @@ public class SanityBasicTests extends TestCase {
}
}
- //Now validate
- Assert.assertNotNull(fItem);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
- Assert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
- Assert.assertEquals("second Java Commit", fItem.getItem().getDescription());
- Assert.assertEquals(4, fItem.getChildren().length);
+ // Now validate
+ r4eAssert.assertNotNull(fItem);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
+ r4eAssert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
+ r4eAssert.assertEquals("second Java Commit", fItem.getItem().getDescription());
+ r4eAssert.assertEquals(4, fItem.getChildren().length);
for (int i = 0; i < fItem.getChildren().length; i++) {
if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
fAnomalyFileIndex = i; //Used later to add anomalies
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
- Assert.assertEquals(606, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(606, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(25,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(0)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertEquals(665, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(25, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(0)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertEquals(665, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(63,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(1)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertEquals(733, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(63, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(1)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertEquals(733, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(2)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(61,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(2)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertEquals(61, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(2)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fItem.getChildren()[i]).getContentsContainerElement().getChildren(), true,
R4EUIConstants.DELTA_ANNOTATION_ID));
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE4_PROJ_NAME)) {
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE3_PROJ_NAME)) {
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE2_PROJ_NAME)) {
- Assert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getTarget());
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getTarget());
}
}
+ r4eAssert.setTest("Create Manual Tree Item");
fItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
- Assert.assertNotNull(fItem2);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
+ r4eAssert.assertNotNull(fItem2);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(0, ((R4ETextPosition) fItem2.getItem()
+ r4eAssert.assertEquals(0, ((R4ETextPosition) fItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(755, ((R4ETextPosition) fItem2.getItem()
+ r4eAssert.assertEquals(755, ((R4ETextPosition) fItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.setTest("Create Manual Text Item");
fItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
- Assert.assertNotNull(fItem3);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
+ r4eAssert.assertNotNull(fItem3);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(50, ((R4ETextPosition) fItem3.getItem()
+ r4eAssert.assertEquals(50, ((R4ETextPosition) fItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(20, ((R4ETextPosition) fItem3.getItem()
+ r4eAssert.assertEquals(20, ((R4ETextPosition) fItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
R4EUIConstants.SELECTION_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create Participant Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createParticipants
*/
private void createParticipants() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createParticipants");
+
+ r4eAssert.setTest("Create Participant");
+
List<R4EParticipant> participants = new ArrayList<R4EParticipant>(1);
R4EParticipant participant = RModelFactory.eINSTANCE.createR4EParticipant();
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
participants.add(participant);
fParticipant = fProxy.getParticipantProxy().createParticipant(fReview.getParticipantContainer(), participants);
- Assert.assertNotNull(fParticipant);
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId());
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail());
- Assert.assertEquals(R4EUserRole.R4E_ROLE_REVIEWER, fParticipant.getParticipant().getRoles().get(0));
+ r4eAssert.setTest("Create Participant");
+ r4eAssert.assertNotNull(fParticipant);
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail());
+ r4eAssert.assertEquals(R4EUserRole.R4E_ROLE_REVIEWER, fParticipant.getParticipant().getRoles().get(0));
}
+ // ------------------------------------------------------------------------
+ // Create Compare Editor Anomalies Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createEditorAnomalies
*/
private void createCompareEditorAnomalies() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createCompareEditorAnomalies");
+
+ r4eAssert.setTest("Create Compare Editor Anomaly");
fCompareEditorAnomaly = fProxy.getAnomalyProxy().createCompareEditorAnomaly(
fItem.getFileContexts().get(fAnomalyFileIndex), 20, 50,
TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS, TestConstants.ANOMALY_TEST_RANK_MINOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fCompareEditorAnomaly);
- Assert.assertEquals(TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, fCompareEditorAnomaly.getAnomaly()
+ r4eAssert.assertNotNull(fCompareEditorAnomaly);
+ r4eAssert.assertEquals(TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, fCompareEditorAnomaly.getAnomaly()
.getTitle());
- Assert.assertEquals(TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION, fCompareEditorAnomaly.getAnomaly()
- .getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS,
+ r4eAssert.assertEquals(TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION,
+ fCompareEditorAnomaly.getAnomaly().getDescription());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS,
((R4ECommentType) fCompareEditorAnomaly.getAnomaly().getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fCompareEditorAnomaly.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fCompareEditorAnomaly.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fCompareEditorAnomaly.getAnomaly()
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fCompareEditorAnomaly.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fCompareEditorAnomaly.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fCompareEditorAnomaly.getAnomaly()
.getAssignedTo()
.get(0));
- Assert.assertEquals(20, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
+ r4eAssert.assertEquals(20, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(50, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
+ r4eAssert.assertEquals(50, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create Linked Anomaly Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createLinkedAnomalies
*/
private void createLinkedAnomalies() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createLinkedAnomalies");
+
+ r4eAssert.setTest("Create Linked Anomaly");
R4EUIContent content = fItem.getFileContexts()
.get(fAnomalyFileIndex)
.getContentsContainerElement()
@@ -461,151 +522,204 @@ public class SanityBasicTests extends TestCase {
TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fLinkedAnomaly);
- Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly.getAnomaly().getTitle());
- Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly.getAnomaly().getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, ((R4ECommentType) fLinkedAnomaly.getAnomaly()
- .getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
+ r4eAssert.assertNotNull(fLinkedAnomaly);
+ r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly.getAnomaly().getTitle());
+ r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly.getAnomaly()
+ .getDescription());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
+ ((R4ECommentType) fLinkedAnomaly.getAnomaly().getType()).getType());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly.getAnomaly().getAssignedTo().get(0));
+ r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getOffset(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create External Anomaly Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createExternalAnomalies
*/
private void createExternalAnomalies() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createExternalAnomalies");
+
+ r4eAssert.setTest("Create External Anomaly");
fExternalAnomaly = fProxy.getAnomalyProxy().createExternalAnomaly(TestUtils.FJavaFile3,
TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_QUESTION, TestConstants.ANOMALY_TEST_RANK_MINOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fExternalAnomaly);
- Assert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, fExternalAnomaly.getAnomaly().getTitle());
- Assert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION, fExternalAnomaly.getAnomaly()
+ r4eAssert.assertNotNull(fExternalAnomaly);
+ r4eAssert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, fExternalAnomaly.getAnomaly().getTitle());
+ r4eAssert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION, fExternalAnomaly.getAnomaly()
.getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_QUESTION, ((R4ECommentType) fExternalAnomaly.getAnomaly()
- .getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fExternalAnomaly.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fExternalAnomaly.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fExternalAnomaly.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_QUESTION,
+ ((R4ECommentType) fExternalAnomaly.getAnomaly().getType()).getType());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fExternalAnomaly.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fExternalAnomaly.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fExternalAnomaly.getAnomaly()
+ .getAssignedTo()
+ .get(0));
+ r4eAssert.assertEquals(
0,
((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(755, ((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly()
+ r4eAssert.assertEquals(755, ((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create Comment Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createComments
*/
private void createComments() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createComments");
+
+ r4eAssert.setTest("Create Comment");
fComment = fProxy.getCommentProxy().createComment(fLinkedAnomaly, TestConstants.COMMENT_TEST);
- Assert.assertNotNull(fComment);
- Assert.assertEquals(TestConstants.COMMENT_TEST, fComment.getComment().getDescription());
+ r4eAssert.assertNotNull(fComment);
+ r4eAssert.assertEquals(TestConstants.COMMENT_TEST, fComment.getComment().getDescription());
}
+ // ------------------------------------------------------------------------
+ // Progress Review Tests
+ // ------------------------------------------------------------------------
+
/**
* Method progressReview
*/
private void progressReview() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("progressReview");
+
+ r4eAssert.setTest("Progress Review");
fProxy.getReviewProxy().progressReview(fReview);
- Assert.assertEquals(R4EReviewPhase.R4E_REVIEW_PHASE_COMPLETED,
- ((R4EReviewState) fReview.getReview().getState()).getState());
- Assert.assertNotNull(fReview.getReview().getEndDate());
+ r4eAssert.assertEquals(R4EReviewPhase.R4E_REVIEW_PHASE_COMPLETED, ((R4EReviewState) fReview.getReview()
+ .getState()).getState());
+ r4eAssert.assertNotNull(fReview.getReview().getEndDate());
}
+ // ------------------------------------------------------------------------
+ // Sorters Tests
+ // ------------------------------------------------------------------------
+
/**
* Method verifySorters
*/
- public void verifySorters() {
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ private void verifySorters() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("verifySorters");
+
+ r4eAssert.setTest("Initial State");
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //Alpha sorter On/Off
+ // Alpha sorter On/Off
+ r4eAssert.setTest("Alpha Sorter On/Off");
fProxy.getCommandProxy().toggleAlphaSorter();
ViewerComparator activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
fProxy.getCommandProxy().toggleAlphaSorter();
- Assert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //Review Type sorter On/Off
+ // Review Type sorter On/Off
+ r4eAssert.setTest("Review Type Sorter On/Off");
fProxy.getCommandProxy().toggleReviewTypeSorter();
activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
fProxy.getCommandProxy().toggleReviewTypeSorter();
- Assert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //AlphaSorter -> ReviewTypeSorter
+ // AlphaSorter -> ReviewTypeSorter
+ r4eAssert.setTest("AlphaSorter -> ReviewTypeSorter");
fProxy.getCommandProxy().toggleAlphaSorter();
activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
fProxy.getCommandProxy().toggleReviewTypeSorter();
activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //ReviewTypeSorter -> AlphaSorter
+ // ReviewTypeSorter -> AlphaSorter
+ r4eAssert.setTest("ReviewTypeSorter -> AlphaSorter");
fProxy.getCommandProxy().toggleAlphaSorter();
activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //Remove AlphaSorter
+ // Remove AlphaSorter
+ r4eAssert.setTest("Remove AlphaSorter");
fProxy.getCommandProxy().toggleAlphaSorter();
- Assert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
}
+ // ------------------------------------------------------------------------
+ // Send Question Notification Tests
+ // ------------------------------------------------------------------------
+
/**
* Method sendQuestionNotifications
*
* @throws CoreException
*/
private void sendQuestionNotifications() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("sendQuestionNotifications");
+
+ r4eAssert.setTest("Send Question Notifications");
fProxy.getCommandProxy().sendQuestionNotification(fReview);
- Assert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SOURCE, fProxy.getCommandProxy()
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SOURCE, fProxy.getCommandProxy()
.getEmailDetails()
.getSource());
String[] destinations = fProxy.getCommandProxy().getEmailDetails().getDestinations();
for (int i = 0; i < destinations.length; i++) {
- Assert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_DESTINATIONS[i], destinations[i]);
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_DESTINATIONS[i], destinations[i]);
}
- Assert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SUBJECT, fProxy.getCommandProxy()
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SUBJECT, fProxy.getCommandProxy()
.getEmailDetails()
.getSubject());
//TODO: Assert fails, but Strings seem to be identical???
/*
- Assert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_BODY, fProxy.getCommandProxy()
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_BODY, fProxy.getCommandProxy()
.getEmailDetails()
.getBody());
*/
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java
index 5ad417c..465d3b0 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java
@@ -12,7 +12,7 @@
*
* Contributors:
* Jacques Bouthillier - Created for Mylyn Review R4E project
- *
+ * Francois Chouinard - Add identifying message to each assert
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.sanity;
@@ -21,7 +21,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -54,6 +53,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.sorters.ReviewTypeComparator;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
@@ -62,7 +62,7 @@ import org.junit.Before;
/**
* @author lmcbout
*/
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class SanityInformalTests extends TestCase {
// ------------------------------------------------------------------------
@@ -96,7 +96,7 @@ public class SanityInformalTests extends TestCase {
private int fAnomalyFileIndex;
// ------------------------------------------------------------------------
- // Methods
+ // Housekeeping
// ------------------------------------------------------------------------
/**
@@ -116,8 +116,8 @@ public class SanityInformalTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
fProxy = R4EUITestMain.getInstance();
createReviewGroups();
@@ -131,12 +131,16 @@ public class SanityInformalTests extends TestCase {
*
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fProxy = null;
}
+ // ------------------------------------------------------------------------
+ // Main test case
+ // ------------------------------------------------------------------------
+
/**
* Method testInformalReviews
*
@@ -159,14 +163,22 @@ public class SanityInformalTests extends TestCase {
verifySorters();
}
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroups
*/
private void createReviewGroups() {
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewGroups");
+
fGroup = null;
- //Create Review Group
+ // Create Review Group
+ r4eAssert.setTest("Create Review Group");
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(TestConstants.REVIEW_GROUP_TEST_NAME)) {
fGroup = group;
@@ -180,20 +192,21 @@ public class SanityInformalTests extends TestCase {
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
- Assert.assertNotNull(fGroup);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertNotNull(fGroup);
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup().getDescription());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
+ .getDescription());
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, fGroup.getReviewGroup()
.getDefaultEntryCriteria());
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], fGroup.getReviewGroup()
.getAvailableProjects()
.get(i));
}
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], fGroup.getReviewGroup()
.getAvailableComponents()
.get(i));
}
@@ -201,11 +214,20 @@ public class SanityInformalTests extends TestCase {
}
}
+ // ------------------------------------------------------------------------
+ // Create Review Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createReviews
*/
private void createReviews() {
- //Update Review Group handle
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviews");
+
+ // Update Review Group handle
+ r4eAssert.setTest("Update Review Group Handle");
for (IR4EUIModelElement elem : R4EUIModelController.getRootElement().getChildren()) {
if (fGroupName.equals(elem.getName())) {
fGroup = (R4EUIReviewGroup) elem;
@@ -214,36 +236,47 @@ public class SanityInformalTests extends TestCase {
if (!fGroup.isOpen()) {
fProxy.getCommandProxy().openElement(fGroup);
}
- Assert.assertTrue(fGroup.isOpen());
+ r4eAssert.assertTrue(fGroup.isOpen());
+ r4eAssert.setTest("Create Review");
fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TestConstants.REVIEW_TEST_NAME_INF, TestConstants.REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
TestConstants.REVIEW_TEST_OBJECTIVES, TestConstants.REVIEW_TEST_REFERENCE_MATERIALS);
- Assert.assertNotNull(fReview);
- Assert.assertNotNull(fReview.getParticipantContainer());
- Assert.assertNotNull(fReview.getAnomalyContainer());
- Assert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
- Assert.assertEquals(TestConstants.REVIEW_TEST_NAME_INF, fReview.getReview().getName());
- Assert.assertEquals(TestConstants.REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
- Assert.assertEquals(TestConstants.REVIEW_TEST_DUE_DATE, fReview.getReview().getDueDate());
- Assert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
+ r4eAssert.assertNotNull(fReview);
+ r4eAssert.assertNotNull(fReview.getParticipantContainer());
+ r4eAssert.assertNotNull(fReview.getAnomalyContainer());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_TYPE_INFORMAL, fReview.getReview().getType());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_NAME_INF, fReview.getReview().getName());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_DESCRIPTION, fReview.getReview().getExtraNotes());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_DUE_DATE, fReview.getReview().getDueDate());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_PROJECT, fReview.getReview().getProject());
for (int i = 0; i < TestConstants.REVIEW_TEST_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_COMPONENTS[i], fReview.getReview().getComponents().get(i));
}
- Assert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
- Assert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
- Assert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview().getReferenceMaterial());
- Assert.assertTrue(fReview.isOpen());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_ENTRY_CRITERIA, fReview.getReview().getEntryCriteria());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_OBJECTIVES, fReview.getReview().getObjectives());
+ r4eAssert.assertEquals(TestConstants.REVIEW_TEST_REFERENCE_MATERIALS, fReview.getReview()
+ .getReferenceMaterial());
+ r4eAssert.assertTrue(fReview.isOpen());
}
+ // ------------------------------------------------------------------------
+ // Create Review Item Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewItems
*/
private void createReviewItems() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewItems");
+
+ // Close and re-open, so the validation takes de-serialized information
+ r4eAssert.setTest("Create Commit Item");
fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
- //close and re-open, so the validation takes de-serialized information
String itemName = fItem.getName();
fProxy.getCommandProxy().closeElement(fReview);
fProxy.getCommandProxy().openElement(fReview);
@@ -254,210 +287,237 @@ public class SanityInformalTests extends TestCase {
}
//Now validate
- Assert.assertNotNull(fItem);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
- Assert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
- Assert.assertEquals("second Java Commit", fItem.getItem().getDescription());
- Assert.assertEquals(4, fItem.getChildren().length);
+ r4eAssert.assertNotNull(fItem);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
+ r4eAssert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
+ r4eAssert.assertEquals("second Java Commit", fItem.getItem().getDescription());
+ r4eAssert.assertEquals(4, fItem.getChildren().length);
for (int i = 0; i < fItem.getChildren().length; i++) {
if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
fAnomalyFileIndex = i; //Used later to add anomalies
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE1_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
- Assert.assertEquals(606, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(606, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(25,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(0)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertEquals(665, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(25, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(0)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertEquals(665, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(1)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(63,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(1)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertEquals(733, ((R4ETextPosition) fItem.getItem()
+ r4eAssert.assertEquals(63, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(1)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertEquals(733, ((R4ETextPosition) fItem.getItem()
.getFileContextList()
.get(i)
.getDeltas()
.get(2)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(61,
- ((R4ETextPosition) fItem.getItem()
- .getFileContextList()
- .get(i)
- .getDeltas()
- .get(2)
- .getTarget()
- .getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertEquals(61, ((R4ETextPosition) fItem.getItem()
+ .getFileContextList()
+ .get(i)
+ .getDeltas()
+ .get(2)
+ .getTarget()
+ .getLocation()).getLength());
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fItem.getChildren()[i]).getContentsContainerElement().getChildren(), true,
R4EUIConstants.DELTA_ANNOTATION_ID));
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE4_PROJ_NAME)) {
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE3_PROJ_NAME)) {
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getTarget()
.getName());
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE2_PROJ_NAME)) {
- Assert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE2_PROJ_NAME, fItem.getItem()
.getFileContextList()
.get(i)
.getBase()
.getName());
- Assert.assertNull(fItem.getItem().getFileContextList().get(i).getTarget());
+ r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getTarget());
}
}
+ r4eAssert.setTest("Create Manual Tree Item");
fItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
- Assert.assertNotNull(fItem2);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
+ r4eAssert.assertNotNull(fItem2);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(0, ((R4ETextPosition) fItem2.getItem()
+ r4eAssert.assertEquals(0, ((R4ETextPosition) fItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(755, ((R4ETextPosition) fItem2.getItem()
+ r4eAssert.assertEquals(755, ((R4ETextPosition) fItem2.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.setTest("Create Manual Text Item");
fItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
- Assert.assertNotNull(fItem3);
- Assert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
+ r4eAssert.assertNotNull(fItem3);
+ r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
.getFileContextList()
.get(0)
.getBase()
.getName());
- Assert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
+ r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
.getFileContextList()
.get(0)
.getTarget()
.getName());
- Assert.assertEquals(50, ((R4ETextPosition) fItem3.getItem()
+ r4eAssert.assertEquals(50, ((R4ETextPosition) fItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getStartPosition());
- Assert.assertEquals(20, ((R4ETextPosition) fItem3.getItem()
+ r4eAssert.assertEquals(20, ((R4ETextPosition) fItem3.getItem()
.getFileContextList()
.get(0)
.getDeltas()
.get(0)
.getTarget()
.getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
((R4EUIFileContext) fItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
R4EUIConstants.SELECTION_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create Participant Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createParticipants
*/
private void createParticipants() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createParticipants");
+
+ r4eAssert.setTest("Create Participant");
+
List<R4EParticipant> participants = new ArrayList<R4EParticipant>(1);
R4EParticipant participant = RModelFactory.eINSTANCE.createR4EParticipant();
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
participants.add(participant);
fParticipant = fProxy.getParticipantProxy().createParticipant(fReview.getParticipantContainer(), participants);
- Assert.assertNotNull(fParticipant);
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId());
- Assert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail());
- Assert.assertEquals(R4EUserRole.R4E_ROLE_REVIEWER, fParticipant.getParticipant().getRoles().get(0));
+ r4eAssert.assertNotNull(fParticipant);
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail());
+ r4eAssert.assertEquals(R4EUserRole.R4E_ROLE_REVIEWER, fParticipant.getParticipant().getRoles().get(0));
}
+ // ------------------------------------------------------------------------
+ // Create Compare Editor Anomalies Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createEditorAnomalies
*/
private void createCompareEditorAnomalies() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createCompareEditorAnomalies");
+
+ r4eAssert.setTest("Create Compare Editor Anomaly");
fCompareEditorAnomaly = fProxy.getAnomalyProxy().createCompareEditorAnomaly(
fItem.getFileContexts().get(fAnomalyFileIndex), 20, 50,
TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS, TestConstants.ANOMALY_TEST_RANK_MINOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fCompareEditorAnomaly);
- Assert.assertEquals(TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, fCompareEditorAnomaly.getAnomaly()
+ r4eAssert.assertNotNull(fCompareEditorAnomaly);
+ r4eAssert.assertEquals(TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, fCompareEditorAnomaly.getAnomaly()
.getTitle());
- Assert.assertEquals(TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION, fCompareEditorAnomaly.getAnomaly()
- .getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS,
+ r4eAssert.assertEquals(TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION,
+ fCompareEditorAnomaly.getAnomaly().getDescription());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS,
((R4ECommentType) fCompareEditorAnomaly.getAnomaly().getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fCompareEditorAnomaly.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fCompareEditorAnomaly.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fCompareEditorAnomaly.getAnomaly()
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fCompareEditorAnomaly.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fCompareEditorAnomaly.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fCompareEditorAnomaly.getAnomaly()
.getAssignedTo()
.get(0));
- Assert.assertEquals(20, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
+ r4eAssert.assertEquals(20, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(50, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
+ r4eAssert.assertEquals(50, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create Linked Anomaly Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createLinkedAnomalies
*/
private void createLinkedAnomalies() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createLinkedAnomalies");
+
+ r4eAssert.setTest("Create Linked Anomaly");
R4EUIContent content = fItem.getFileContexts()
.get(fAnomalyFileIndex)
.getContentsContainerElement()
@@ -467,85 +527,119 @@ public class SanityInformalTests extends TestCase {
TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fLinkedAnomaly);
- Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly.getAnomaly().getTitle());
- Assert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly.getAnomaly().getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, ((R4ECommentType) fLinkedAnomaly.getAnomaly()
- .getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
+ r4eAssert.assertNotNull(fLinkedAnomaly);
+ r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly.getAnomaly().getTitle());
+ r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly.getAnomaly()
+ .getDescription());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
+ ((R4ECommentType) fLinkedAnomaly.getAnomaly().getType()).getType());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MAJOR, fLinkedAnomaly.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fLinkedAnomaly.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fLinkedAnomaly.getAnomaly().getAssignedTo().get(0));
+ r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getOffset(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(
+ r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create External Anomaly Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createExternalAnomalies
*/
private void createExternalAnomalies() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createExternalAnomalies");
+
+ r4eAssert.setTest("Create External Anomaly");
fExternalAnomaly = fProxy.getAnomalyProxy().createExternalAnomaly(TestUtils.FJavaFile3,
TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_QUESTION, TestConstants.ANOMALY_TEST_RANK_MINOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
- Assert.assertNotNull(fExternalAnomaly);
- Assert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, fExternalAnomaly.getAnomaly().getTitle());
- Assert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION, fExternalAnomaly.getAnomaly()
+ r4eAssert.assertNotNull(fExternalAnomaly);
+ r4eAssert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, fExternalAnomaly.getAnomaly().getTitle());
+ r4eAssert.assertEquals(TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION, fExternalAnomaly.getAnomaly()
.getDescription());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_QUESTION, ((R4ECommentType) fExternalAnomaly.getAnomaly()
- .getType()).getType());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fExternalAnomaly.getAnomaly().getRank());
- Assert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fExternalAnomaly.getAnomaly().getDueDate());
- Assert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fExternalAnomaly.getAnomaly().getAssignedTo().get(0));
- Assert.assertEquals(
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_CLASS_QUESTION,
+ ((R4ECommentType) fExternalAnomaly.getAnomaly().getType()).getType());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_RANK_MINOR, fExternalAnomaly.getAnomaly().getRank());
+ r4eAssert.assertEquals(TestConstants.ANOMALY_TEST_DUE_DATE, fExternalAnomaly.getAnomaly().getDueDate());
+ r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fExternalAnomaly.getAnomaly()
+ .getAssignedTo()
+ .get(0));
+ r4eAssert.assertEquals(
0,
((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly().getLocation().get(0)).getLocation()).getStartPosition());
- Assert.assertEquals(755, ((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly()
+ r4eAssert.assertEquals(755, ((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Create Comment Tests
+ // ------------------------------------------------------------------------
+
/**
* Method createComments
*/
private void createComments() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createComments");
+
+ r4eAssert.setTest("Create Comment");
fComment = fProxy.getCommentProxy().createComment(fLinkedAnomaly, TestConstants.COMMENT_TEST);
- Assert.assertNotNull(fComment);
- Assert.assertEquals(TestConstants.COMMENT_TEST, fComment.getComment().getDescription());
+ r4eAssert.assertNotNull(fComment);
+ r4eAssert.assertEquals(TestConstants.COMMENT_TEST, fComment.getComment().getDescription());
}
+ // ------------------------------------------------------------------------
+ // Send Question Notification Tests
+ // ------------------------------------------------------------------------
+
/**
* Method sendQuestionNotifications
*
* @throws CoreException
*/
private void sendQuestionNotifications() throws CoreException {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("sendQuestionNotifications");
+
+ r4eAssert.setTest("Send Question Notifications");
fProxy.getCommandProxy().sendQuestionNotification(fReview);
- Assert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SOURCE, fProxy.getCommandProxy()
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SOURCE, fProxy.getCommandProxy()
.getEmailDetails()
.getSource());
String[] destinations = fProxy.getCommandProxy().getEmailDetails().getDestinations();
for (int i = 0; i < destinations.length; i++) {
- Assert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_DESTINATIONS[i], destinations[i]);
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_DESTINATIONS[i], destinations[i]);
}
- Assert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SUBJECT_INFORMAL, fProxy.getCommandProxy()
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SUBJECT_INFORMAL, fProxy.getCommandProxy()
.getEmailDetails()
.getSubject());
//TODO: Assert fails, but Strings seem to be identical???
-// Assert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_BODY_INFORMAL, fProxy.getCommandProxy()
+// r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_BODY_INFORMAL, fProxy.getCommandProxy()
// .getEmailDetails()
// .getBody());
}
+ // ------------------------------------------------------------------------
+ // Progress Anomaly Tests
+ // ------------------------------------------------------------------------
+
/**
* On top of the basic scenario, we need for the INFORMAl review the following test <br>
* - Adjust the state for the anomaly <br>
@@ -558,13 +652,18 @@ public class SanityInformalTests extends TestCase {
* Method progressCompareEditorAnomalies
*/
private void progressCompareEditorAnomalies() {
- Assert.assertNotNull(fCompareEditorAnomaly);
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("progressCompareEditorAnomalies");
+
+ r4eAssert.setTest("Progress Compare Editor Anomaly");
+ r4eAssert.assertNotNull(fCompareEditorAnomaly);
fProxy.getAnomalyProxy().progressAnomaly(fCompareEditorAnomaly, TestConstants.ANOMALY_STATE_VERIFIED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_VERIFIED, fCompareEditorAnomaly.getAnomaly().getState());
- Assert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_VERIFIED, fCompareEditorAnomaly.getAnomaly().getState());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
}
@@ -572,13 +671,18 @@ public class SanityInformalTests extends TestCase {
* Method progressLinkedAnomalies
*/
private void progressLinkedAnomalies() {
- Assert.assertNotNull(fLinkedAnomaly);
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("progressLinkedAnomalies");
+
+ r4eAssert.setTest("Progress Linked Anomaly");
+ r4eAssert.assertNotNull(fLinkedAnomaly);
fProxy.getAnomalyProxy().progressAnomaly(fLinkedAnomaly, TestConstants.ANOMALY_STATE_FIXED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fLinkedAnomaly.getAnomaly().getState());
- Assert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fLinkedAnomaly.getAnomaly().getState());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
}
@@ -586,86 +690,116 @@ public class SanityInformalTests extends TestCase {
* Method progressExternalAnomalies
*/
private void progressExternalAnomalies() {
- Assert.assertNotNull(fExternalAnomaly);
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("progressExternalAnomalies");
+
+ r4eAssert.setTest("Progress External Anomaly");
+ r4eAssert.assertNotNull(fExternalAnomaly);
fProxy.getAnomalyProxy().progressAnomaly(fExternalAnomaly, TestConstants.ANOMALY_STATE_REJECTED);
- Assert.assertEquals(TestConstants.ANOMALY_STATE_REJECTED, fExternalAnomaly.getAnomaly().getState());
- Assert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
+ r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_REJECTED, fExternalAnomaly.getAnomaly().getState());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
- Assert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
+ r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Progress Review Tests
+ // ------------------------------------------------------------------------
+
/**
* Method progressReview
*/
private void progressReview() {
- Assert.assertEquals(TestConstants.REVIEW_EXIT_DECISION_ACCEPTED, fReview.getReview().getDecision().getValue()); //Test the default exit decision
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("progressReview");
+
+ r4eAssert.setTest("Progress Review");
+ r4eAssert.assertEquals(TestConstants.REVIEW_EXIT_DECISION_ACCEPTED, fReview.getReview()
+ .getDecision()
+ .getValue()); //Test the default exit decision
fProxy.getReviewProxy().progressReview(fReview);
- Assert.assertEquals(R4EReviewPhase.R4E_REVIEW_PHASE_COMPLETED,
- ((R4EReviewState) fReview.getReview().getState()).getState());
- Assert.assertNotNull(fReview.getReview().getEndDate());
+ r4eAssert.assertEquals(R4EReviewPhase.R4E_REVIEW_PHASE_COMPLETED, ((R4EReviewState) fReview.getReview()
+ .getState()).getState());
+ r4eAssert.assertNotNull(fReview.getReview().getEndDate());
}
+ // ------------------------------------------------------------------------
+ // Sorters Tests
+ // ------------------------------------------------------------------------
+
/**
* Method verifySorters
*/
- public void verifySorters() {
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ private void verifySorters() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("verifySorters");
+
+ r4eAssert.setTest("Initial State");
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //Alpha sorter On/Off
+ // Alpha sorter On/Off
+ r4eAssert.setTest("Alpha Sorter On/Off");
fProxy.getCommandProxy().toggleAlphaSorter();
ViewerComparator activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
fProxy.getCommandProxy().toggleAlphaSorter();
- Assert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //Review Type sorter On/Off
+ // Review Type sorter On/Off
+ r4eAssert.setTest("Review Type Sorter On/Off");
fProxy.getCommandProxy().toggleReviewTypeSorter();
activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
fProxy.getCommandProxy().toggleReviewTypeSorter();
- Assert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //AlphaSorter -> ReviewTypeSorter
+ // AlphaSorter -> ReviewTypeSorter
+ r4eAssert.setTest("AlphaSorter -> ReviewTypeSorter");
fProxy.getCommandProxy().toggleAlphaSorter();
activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
fProxy.getCommandProxy().toggleReviewTypeSorter();
activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //ReviewTypeSorter -> AlphaSorter
+ // ReviewTypeSorter -> AlphaSorter
+ r4eAssert.setTest("ReviewTypeSorter -> AlphaSorter");
fProxy.getCommandProxy().toggleAlphaSorter();
activeSorter = fProxy.getCommandProxy().getActiveSorter();
- Assert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
+ r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- Assert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- //Remove AlphaSorter
+ // Remove AlphaSorter
+ r4eAssert.setTest("Remove AlphaSorter");
fProxy.getCommandProxy().toggleAlphaSorter();
- Assert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- Assert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java
index a64e07c..501d2ff 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java
@@ -12,7 +12,7 @@
*
* Contributors:
* Sebastien Dubois - Created for Mylyn Review R4E project
- *
+ * Francois Chouinard - Add identifying message to each assert
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.sanity;
@@ -20,7 +20,6 @@ package org.eclipse.mylyn.reviews.r4e.ui.tests.sanity;
import java.io.File;
import java.net.URL;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -42,12 +41,13 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRuleViolation;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.UIUtils;
import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
import org.junit.Before;
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class SanitySetupTests extends TestCase {
// ------------------------------------------------------------------------
@@ -57,11 +57,11 @@ public class SanitySetupTests extends TestCase {
private R4EUITestMain fProxy = null;
// ------------------------------------------------------------------------
- // Methods
+ // Housekeeping
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
+ * Sets up the global test environment, if not already done at the suite level.
*
* @return Test
*/
@@ -72,30 +72,34 @@ public class SanitySetupTests extends TestCase {
}
/**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
+ * Sets up the fixture, for example, open a network connection. This method is called before a test is executed.
*
* @throws java.lang.Exception
*/
- @Override
@Before
+ @Override
public void setUp() throws Exception {
fProxy = R4EUITestMain.getInstance();
}
/**
- * Method tearDown
+ * Cleanup after the test has completed
*
* @throws java.lang.Exception
*/
- @Override
@After
+ @Override
public void tearDown() throws Exception {
fProxy = null;
}
+ // ------------------------------------------------------------------------
+ // Main test case
+ // ------------------------------------------------------------------------
+
/**
- * Method testSetup
+ * The main test case. It invokes the sub-tests sequentially thus avoiding synchronization issues in the shared data
+ * structures.
*
* @throws ExecutionException
* @throws NotDefinedException
@@ -105,11 +109,126 @@ public class SanitySetupTests extends TestCase {
* @throws OutOfSyncException
*/
public void testSetup() {
+ TestUtils.waitForJobs();
createRuleSetSetup();
createReviewGroupSetup();
verifyHelp();
}
+ // ------------------------------------------------------------------------
+ // Rule Sets Test
+ // ------------------------------------------------------------------------
+
+ /**
+ * Rule Sets management
+ *
+ * @throws ExecutionException
+ * @throws NotDefinedException
+ * @throws NotEnabledException
+ * @throws NotHandledException
+ * @throws ResourceHandlingException
+ * @throws OutOfSyncException
+ */
+ private void createRuleSetSetup() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createRuleSetSetup");
+
+ // Create a Rule Set
+ r4eAssert.setTest("Create RuleSet");
+ R4EUIRuleSet newRuleSet = fProxy.getRuleSetProxy().createRuleSet(TestUtils.FSharedFolder,
+ TestConstants.RULE_SET_TEST_NAME, TestConstants.RULE_SET_TEST_VERSION);
+ r4eAssert.assertNotNull(newRuleSet);
+ r4eAssert.assertEquals(TestConstants.RULE_SET_TEST_VERSION, newRuleSet.getRuleSet().getVersion());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString(), newRuleSet.getRuleSet()
+ .getFolder());
+ r4eAssert.assertEquals(TestConstants.RULE_SET_TEST_NAME, newRuleSet.getRuleSet().getName());
+
+ // Create a Second Rule Set
+ r4eAssert.setTest("Create 2nd RuleSet");
+ R4EUIRuleSet newRuleSet2 = fProxy.getRuleSetProxy().createRuleSet(TestUtils.FSharedFolder,
+ TestConstants.RULE_SET_TEST_NAME2, TestConstants.RULE_SET_TEST_VERSION);
+ String newRuleSet2Name = newRuleSet2.getName();
+ r4eAssert.assertNotNull(newRuleSet2);
+ r4eAssert.assertEquals(TestConstants.RULE_SET_TEST_VERSION, newRuleSet2.getRuleSet().getVersion());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString(), newRuleSet2.getRuleSet()
+ .getFolder());
+ r4eAssert.assertEquals(TestConstants.RULE_SET_TEST_NAME2, newRuleSet2.getRuleSet().getName());
+
+ // Create Rule Area
+ r4eAssert.setTest("Create Rule Area");
+ R4EUIRuleArea newRuleArea = fProxy.getRuleAreaProxy().createRuleArea(newRuleSet,
+ TestConstants.RULE_AREA_TEST_NAME);
+ r4eAssert.assertNotNull(newRuleArea);
+ r4eAssert.assertEquals(TestConstants.RULE_AREA_TEST_NAME, newRuleArea.getArea().getName());
+
+ // Create Rule Violation
+ r4eAssert.setTest("Create Rule Violation");
+ R4EUIRuleViolation newRuleViolation = fProxy.getRuleViolationProxy().createRuleViolation(newRuleArea,
+ TestConstants.RULE_VIOLATION_TEST_NAME);
+ r4eAssert.assertNotNull(newRuleViolation);
+ r4eAssert.assertEquals(TestConstants.RULE_VIOLATION_TEST_NAME, newRuleViolation.getViolation().getName());
+
+ // Create Rule
+ r4eAssert.setTest("Create Rule");
+ R4EUIRule newRule = fProxy.getRuleProxy().createRule(newRuleViolation, TestConstants.RULE_TEST_ID,
+ TestConstants.RULE_TEST_TITLE, TestConstants.RULE_TEST_DESCRIPTION,
+ UIUtils.getClassFromString(TestConstants.RULE_TEST_CLASS),
+ UIUtils.getRankFromString(TestConstants.RULE_TEST_RANK));
+ r4eAssert.assertNotNull(newRule);
+ r4eAssert.assertEquals(TestConstants.RULE_TEST_ID, newRule.getRule().getId());
+ r4eAssert.assertEquals(TestConstants.RULE_TEST_TITLE, newRule.getRule().getTitle());
+ r4eAssert.assertEquals(TestConstants.RULE_TEST_DESCRIPTION, newRule.getRule().getDescription());
+ r4eAssert.assertEquals(UIUtils.getClassFromString(TestConstants.RULE_TEST_CLASS), newRule.getRule().getClass_());
+ r4eAssert.assertEquals(UIUtils.getRankFromString(TestConstants.RULE_TEST_RANK), newRule.getRule().getRank());
+
+ // Close a Rule Set
+ r4eAssert.setTest("Close RuleSet");
+ fProxy.getCommandProxy().closeElement(newRuleSet);
+ r4eAssert.assertFalse(newRuleSet.isOpen());
+
+ //Open the Closed Rule Set
+ r4eAssert.setTest("Re-Open RuleSet");
+ fProxy.getCommandProxy().openElement(newRuleSet);
+ r4eAssert.assertTrue(newRuleSet.isOpen());
+ r4eAssert.assertEquals(TestConstants.RULE_TEST_ID,
+ ((R4EUIRule) newRuleSet.getChildren()[0].getChildren()[0].getChildren()[0]).getRule().getId());
+
+ // Remove Rule Set from preferences
+ r4eAssert.setTest("Remove RuleSet");
+ String prefsRuleSet = newRuleSet2.getRuleSet().eResource().getURI().toFileString();
+ fProxy.getPreferencesProxy().removeRuleSetFromPreferences(prefsRuleSet);
+ for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
+ if (ruleSet.getRuleSet().getName().equals(newRuleSet2.getRuleSet().getName())) {
+ fail("RuleSet " + prefsRuleSet + " should not be present since it was removed from preferences");
+ }
+ }
+
+ // Add back Rule Set to preferences
+ r4eAssert.setTest("Put Back RuleSet");
+ boolean ruleSetFound = false;
+ fProxy.getPreferencesProxy().addRuleSetToPreferences(prefsRuleSet);
+ for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
+ if (ruleSet.getRuleSet().getName().equals(newRuleSet2.getRuleSet().getName())) {
+ ruleSetFound = true;
+ break;
+ }
+ }
+ r4eAssert.assertTrue(ruleSetFound);
+
+ for (IR4EUIModelElement elem : R4EUIModelController.getRootElement().getChildren()) {
+ if (newRuleSet2Name.equals(elem.getName())) {
+ newRuleSet2 = (R4EUIRuleSet) elem;
+ }
+ }
+ fProxy.getCommandProxy().openElement(newRuleSet2);
+ r4eAssert.assertTrue(newRuleSet2.isOpen());
+ }
+
+ // ------------------------------------------------------------------------
+ // Review Groups Test
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroupSetup
*
@@ -120,66 +239,74 @@ public class SanitySetupTests extends TestCase {
* @throws ResourceHandlingException
* @throws OutOfSyncException
*/
- public void createReviewGroupSetup() {
+ private void createReviewGroupSetup() {
+
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("createReviewGroupSetup");
- //Create Review Group
+ // Create Review Group
+ r4eAssert.setTest("Create Review Group");
R4EUIReviewGroup newGroup = fProxy.getReviewGroupProxy().createReviewGroup(
TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
- Assert.assertNotNull(newGroup);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, newGroup.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertNotNull(newGroup);
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, newGroup.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, newGroup.getReviewGroup().getFolder());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, newGroup.getReviewGroup().getDescription());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, newGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, newGroup.getReviewGroup().getDescription());
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, newGroup.getReviewGroup()
.getDefaultEntryCriteria());
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], newGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], newGroup.getReviewGroup()
.getAvailableProjects()
.get(i));
}
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], newGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], newGroup.getReviewGroup()
.getAvailableComponents()
.get(i));
}
String newGroupName = newGroup.getName();
- //Create a second Review Group
+ // Create a second Review Group
+ r4eAssert.setTest("Create 2nd Review Group");
R4EUIReviewGroup newGroup2 = fProxy.getReviewGroupProxy().createReviewGroup(
TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME2,
TestConstants.REVIEW_GROUP_TEST_NAME2, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
- Assert.assertNotNull(newGroup2);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME2, newGroup2.getReviewGroup().getName());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertNotNull(newGroup2);
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME2, newGroup2.getReviewGroup().getName());
+ r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME2, newGroup2.getReviewGroup().getFolder());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, newGroup2.getReviewGroup().getDescription());
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, newGroup2.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, newGroup2.getReviewGroup().getDescription());
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, newGroup2.getReviewGroup()
.getDefaultEntryCriteria());
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], newGroup2.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS[i], newGroup2.getReviewGroup()
.getAvailableProjects()
.get(i));
}
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], newGroup2.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS[i], newGroup2.getReviewGroup()
.getAvailableComponents()
.get(i));
}
- //Close a Review Group
+ // Close a Review Group
+ r4eAssert.setTest("Close Review Group");
fProxy.getCommandProxy().closeElement(newGroup);
- Assert.assertFalse(newGroup.isOpen());
+ r4eAssert.assertFalse(newGroup.isOpen());
- //Open the closed Review Group
+ // Open the closed Review Group
+ r4eAssert.setTest("Re-Open Review Group");
fProxy.getCommandProxy().openElement(newGroup);
- Assert.assertTrue(newGroup.isOpen());
+ r4eAssert.assertTrue(newGroup.isOpen());
- //Remove Review Group from preferences
+ // Remove Review Group from preferences
+ r4eAssert.setTest("Remove Review Group");
String prefsGroup = newGroup2.getReviewGroup().eResource().getURI().toFileString();
fProxy.getPreferencesProxy().removeGroupFromPreferences(prefsGroup);
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
@@ -188,7 +315,8 @@ public class SanitySetupTests extends TestCase {
}
}
- //Add back Review Group to preferences
+ // Add back Review Group to preferences
+ r4eAssert.setTest("Add Removed Review Group");
boolean groupFound = false;
fProxy.getPreferencesProxy().addGroupToPreferences(prefsGroup);
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
@@ -197,31 +325,33 @@ public class SanitySetupTests extends TestCase {
break;
}
}
- Assert.assertTrue(groupFound);
+ r4eAssert.assertTrue(groupFound);
- //Get back handle to Review Group since view is refreshed
+ // Get back handle to Review Group since view is refreshed
+ r4eAssert.setTest("Check Selected Element");
for (IR4EUIModelElement elem : R4EUIModelController.getRootElement().getChildren()) {
if (newGroupName.equals(elem.getName())) {
newGroup = (R4EUIReviewGroup) elem;
}
}
fProxy.getCommandProxy().openElement(newGroup);
- Assert.assertTrue(newGroup.isOpen());
+ r4eAssert.assertTrue(newGroup.isOpen());
- //Update Review Group properties
+ // Update Review Group properties
+ r4eAssert.setTest("Update Properties");
fProxy.getReviewGroupProxy().changeReviewGroupDescription(newGroup,
TestConstants.REVIEW_GROUP_TEST_DESCRIPTION2);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION2, newGroup.getReviewGroup().getDescription());
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION2, newGroup.getReviewGroup().getDescription());
fProxy.getReviewGroupProxy().changeReviewGroupDefaultEntryCriteria(newGroup,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA2);
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA2, newGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA2, newGroup.getReviewGroup()
.getDefaultEntryCriteria());
fProxy.getReviewGroupProxy().removeReviewGroupAvailableProject(newGroup,
TestConstants.REVIEW_GROUP_TEST_REM_AVAILABLE_PROJECT);
fProxy.getReviewGroupProxy().addReviewGroupAvailableProject(newGroup,
TestConstants.REVIEW_GROUP_TEST_ADD_AVAILABLE_PROJECT);
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS2.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS2[i], newGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS2[i], newGroup.getReviewGroup()
.getAvailableProjects()
.get(i));
}
@@ -230,7 +360,7 @@ public class SanitySetupTests extends TestCase {
fProxy.getReviewGroupProxy().addReviewGroupAvailableComponent(newGroup,
TestConstants.REVIEW_GROUP_TEST_ADD_AVAILABLE_COMPONENT);
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS2.length; i++) {
- Assert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS2[i], newGroup.getReviewGroup()
+ r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS2[i], newGroup.getReviewGroup()
.getAvailableComponents()
.get(i));
}
@@ -238,7 +368,7 @@ public class SanitySetupTests extends TestCase {
for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
if (ruleSet.getName().equals(TestConstants.RULE_SET_TEST_NAME2)) {
fProxy.getReviewGroupProxy().addReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName());
- Assert.assertEquals(ruleSet.getRuleSet().getName(), newGroup.getReviewGroup()
+ r4eAssert.assertEquals(ruleSet.getRuleSet().getName(), newGroup.getReviewGroup()
.getDesignRuleLocations()
.get(0));
break;
@@ -255,7 +385,7 @@ public class SanitySetupTests extends TestCase {
for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
if (ruleSet.getName().equals(TestConstants.RULE_SET_TEST_NAME)) {
- Assert.assertEquals(ruleSet.getRuleSet().getName(), newGroup.getReviewGroup()
+ r4eAssert.assertEquals(ruleSet.getRuleSet().getName(), newGroup.getReviewGroup()
.getDesignRuleLocations()
.get(0));
break;
@@ -263,108 +393,25 @@ public class SanitySetupTests extends TestCase {
}
}
- /**
- * Method createRuleSetSetup
- *
- * @throws ExecutionException
- * @throws NotDefinedException
- * @throws NotEnabledException
- * @throws NotHandledException
- * @throws ResourceHandlingException
- * @throws OutOfSyncException
- */
- public void createRuleSetSetup() {
-
- //Create a Rule Set
- R4EUIRuleSet newRuleSet = fProxy.getRuleSetProxy().createRuleSet(TestUtils.FSharedFolder,
- TestConstants.RULE_SET_TEST_NAME, TestConstants.RULE_SET_TEST_VERSION);
- Assert.assertNotNull(newRuleSet);
- Assert.assertEquals(TestConstants.RULE_SET_TEST_VERSION, newRuleSet.getRuleSet().getVersion());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString(), newRuleSet.getRuleSet().getFolder());
- Assert.assertEquals(TestConstants.RULE_SET_TEST_NAME, newRuleSet.getRuleSet().getName());
-
- //Create a second Rule Set
- R4EUIRuleSet newRuleSet2 = fProxy.getRuleSetProxy().createRuleSet(TestUtils.FSharedFolder,
- TestConstants.RULE_SET_TEST_NAME2, TestConstants.RULE_SET_TEST_VERSION);
- String newRuleSet2Name = newRuleSet2.getName();
- Assert.assertNotNull(newRuleSet2);
- Assert.assertEquals(TestConstants.RULE_SET_TEST_VERSION, newRuleSet2.getRuleSet().getVersion());
- Assert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString(), newRuleSet2.getRuleSet().getFolder());
- Assert.assertEquals(TestConstants.RULE_SET_TEST_NAME2, newRuleSet2.getRuleSet().getName());
-
- //Create Rule Area
- R4EUIRuleArea newRuleArea = fProxy.getRuleAreaProxy().createRuleArea(newRuleSet,
- TestConstants.RULE_AREA_TEST_NAME);
- Assert.assertNotNull(newRuleArea);
- Assert.assertEquals(TestConstants.RULE_AREA_TEST_NAME, newRuleArea.getArea().getName());
-
- //Create Rule Violation
- R4EUIRuleViolation newRuleViolation = fProxy.getRuleViolationProxy().createRuleViolation(newRuleArea,
- TestConstants.RULE_VIOLATION_TEST_NAME);
- Assert.assertNotNull(newRuleViolation);
- Assert.assertEquals(TestConstants.RULE_VIOLATION_TEST_NAME, newRuleViolation.getViolation().getName());
-
- //Create Rule
- R4EUIRule newRule = fProxy.getRuleProxy().createRule(newRuleViolation, TestConstants.RULE_TEST_ID,
- TestConstants.RULE_TEST_TITLE, TestConstants.RULE_TEST_DESCRIPTION,
- UIUtils.getClassFromString(TestConstants.RULE_TEST_CLASS),
- UIUtils.getRankFromString(TestConstants.RULE_TEST_RANK));
- Assert.assertNotNull(newRule);
- Assert.assertEquals(TestConstants.RULE_TEST_ID, newRule.getRule().getId());
- Assert.assertEquals(TestConstants.RULE_TEST_TITLE, newRule.getRule().getTitle());
- Assert.assertEquals(TestConstants.RULE_TEST_DESCRIPTION, newRule.getRule().getDescription());
- Assert.assertEquals(UIUtils.getClassFromString(TestConstants.RULE_TEST_CLASS), newRule.getRule().getClass_());
- Assert.assertEquals(UIUtils.getRankFromString(TestConstants.RULE_TEST_RANK), newRule.getRule().getRank());
-
- //Close a Rule Set
- fProxy.getCommandProxy().closeElement(newRuleSet);
- Assert.assertFalse(newRuleSet.isOpen());
-
- //Open the closed Rule Set
- fProxy.getCommandProxy().openElement(newRuleSet);
- Assert.assertTrue(newRuleSet.isOpen());
- Assert.assertEquals(TestConstants.RULE_TEST_ID,
- ((R4EUIRule) newRuleSet.getChildren()[0].getChildren()[0].getChildren()[0]).getRule().getId());
-
- //Remove Rule Set from preferences
- String prefsRuleSet = newRuleSet2.getRuleSet().eResource().getURI().toFileString();
- fProxy.getPreferencesProxy().removeRuleSetFromPreferences(prefsRuleSet);
- for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
- if (ruleSet.getRuleSet().getName().equals(newRuleSet2.getRuleSet().getName())) {
- fail("RuleSet " + prefsRuleSet + " should not be present since it was removed from preferences");
- }
- }
-
- //Add back Rule Set to preferences
- boolean ruleSetFound = false;
- fProxy.getPreferencesProxy().addRuleSetToPreferences(prefsRuleSet);
- for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
- if (ruleSet.getRuleSet().getName().equals(newRuleSet2.getRuleSet().getName())) {
- ruleSetFound = true;
- break;
- }
- }
- Assert.assertTrue(ruleSetFound);
-
- for (IR4EUIModelElement elem : R4EUIModelController.getRootElement().getChildren()) {
- if (newRuleSet2Name.equals(elem.getName())) {
- newRuleSet2 = (R4EUIRuleSet) elem;
- }
- }
- fProxy.getCommandProxy().openElement(newRuleSet2);
- Assert.assertTrue(newRuleSet2.isOpen());
- }
+ // ------------------------------------------------------------------------
+ // Help Test
+ // ------------------------------------------------------------------------
/**
* Method verifyHelp
*/
- public void verifyHelp() {
+ private void verifyHelp() {
- //Verify R4E help is present
+ // Assert object
+ R4EAssert r4eAssert = new R4EAssert("verifyHelp");
+
+ // Verify R4E help is present
+ r4eAssert.setTest("Help Presence");
URL openUrl = fProxy.getHelp("/org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/User-Guide.html");
- Assert.assertNotNull(openUrl);
+ r4eAssert.assertNotNull(openUrl);
URL ericssonUrl = fProxy.getHelp("/com.ericsson.reviews.r4e.help/doc/r4eEricsson.html");
- Assert.assertNotNull(ericssonUrl);
+ r4eAssert.assertNotNull(ericssonUrl);
}
+
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/R4EAssert.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/R4EAssert.java
new file mode 100644
index 0000000..8fcc534
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/R4EAssert.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson Research Canada and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.reviews.r4e.ui.tests.utils;
+
+import junit.framework.Assert;
+
+/**
+ * R4E utility to provide some additional location information to tests.
+ *
+ * @author lmcfrch
+ */
+public class R4EAssert {
+
+ // --------------------------------------------------------------------
+ // The test information data
+ // --------------------------------------------------------------------
+
+ private final String fSuite;
+
+ private String fTest;
+
+ private int fStep;
+
+ // --------------------------------------------------------------------
+ // Constructor
+ // --------------------------------------------------------------------
+
+ public R4EAssert(String suite) {
+ fSuite = suite;
+ fTest = ""; //$NON-NLS-1$
+ fStep = 0;
+ }
+
+ // --------------------------------------------------------------------
+ // Operations
+ // --------------------------------------------------------------------
+
+ public void setTest(String test) {
+ fTest = test;
+ fStep = 1;
+ }
+
+ // --------------------------------------------------------------------
+ // Helper functions
+ // --------------------------------------------------------------------
+
+ @SuppressWarnings("nls")
+ private String fmtId() {
+ return "[" + fSuite + ":" + fTest + ":" + fStep++ + "]";
+ }
+
+ // --------------------------------------------------------------------
+ // Asserts with step increment - directly mapped on JUnit's Assert
+ // --------------------------------------------------------------------
+
+ public void assertTrue(boolean condition) {
+ Assert.assertTrue(fmtId(), condition);
+ }
+
+ public void assertFalse(boolean condition) {
+ Assert.assertFalse(fmtId(), condition);
+ }
+
+ public void assertNull(Object object) {
+ Assert.assertNull(fmtId(), object);
+ }
+
+ public void assertNotNull(Object object) {
+ Assert.assertNotNull(fmtId(), object);
+ }
+
+ public void assertEquals(Object expected, Object actual) {
+ Assert.assertEquals(fmtId(), expected, actual);
+ }
+
+ public void assertNotSame(Object expected, Object actual) {
+ Assert.assertNotSame(fmtId(), expected, actual);
+ }
+
+}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java
index 35c1de3..b305893 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java
@@ -41,6 +41,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.Job;
@@ -69,7 +70,7 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-@SuppressWarnings("restriction")
+@SuppressWarnings({ "restriction", "nls" })
public class TestUtils {
// ------------------------------------------------------------------------
@@ -237,16 +238,33 @@ public class TestUtils {
public static ReviewNavigatorView FTestNavigatorView;
// ------------------------------------------------------------------------
- // Methods
+ // Test environment setup
// ------------------------------------------------------------------------
+
public static void setupTestEnvironment() throws CoreException, IOException, URISyntaxException {
FExtProject = ResourcesPlugin.getWorkspace().getRoot().getProject(R4EUITestPlugin.PLUGIN_ID);
+
setupJavaProject();
setupCProject();
setupTextProject();
setupSharedFolder();
}
+ // ------------------------------------------------------------------------
+ // project cleanup
+ // ------------------------------------------------------------------------
+
+ public static void cleanupTestEnvironment() throws CoreException, IOException {
+ cleanupSharedFolder(FSharedFolder);
+ cleanupProject(FTextIProject, FTextRepository);
+ cleanupProject(FCIProject, FCRepository);
+ cleanupProject(FJavaIProject, FJavaRepository);
+ }
+
+ // ------------------------------------------------------------------------
+ // Projects
+ // ------------------------------------------------------------------------
+
private static void setupJavaProject() throws CoreException, IOException, URISyntaxException {
//Create project
@@ -380,48 +398,44 @@ public class TestUtils {
FTextFile5 = addFileToProject(FTextIProject, TEXT_FILE5_PROJ_NAME, TEXT_FILE5_EXT_PATH);
}
+ private static void cleanupProject(IProject aProject, Repository aRepository) throws CoreException, IOException {
+ //Disconnect project from repository
+ disconnectProject(aProject);
+
+ //Delete Repository
+ deleteRepository(aRepository);
+
+ //Delete project
+ deleteProject(aProject);
+ }
+
+ // ------------------------------------------------------------------------
+ // Project helper functions
+ // ------------------------------------------------------------------------
+
private static IProject createProject(String aProjectName) throws CoreException, IOException {
TestUtils.waitForJobs();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(aProjectName);
+ if (project.exists()) {
+ project.delete(true, new NullProgressMonitor());
+ }
project.create(null);
project.open(null);
return project;
}
- private static Repository createRepository(IProject aProject) throws CoreException, IOException {
- TestUtils.waitForJobs();
- File gitDir = new File(aProject.getLocation().toOSString(), Constants.DOT_GIT);
- Repository repository = new FileRepository(gitDir);
- try {
- repository.create();
- Config storedConfig = repository.getConfig();
- storedConfig.setEnum("core", null, "autocrlf", AutoCRLF.FALSE);
-
- } catch (IllegalStateException e) {
- //Jusy go on
- }
- return repository;
- }
-
- private static String getWorkDir(Repository aRepository) throws CoreException, IOException {
- String workDir;
- try {
- workDir = aRepository.getWorkTree().getCanonicalPath();
- } catch (IOException err) {
- workDir = aRepository.getWorkTree().getAbsolutePath();
- }
- workDir = workDir.replace('\\', '/');
- if (!workDir.endsWith("/")) {
- workDir += "/"; //$NON-NLS-1$
+ private static void deleteProject(IProject aProject) throws CoreException, IOException {
+ if (aProject.exists()) {
+ aProject.refreshLocal(IResource.DEPTH_INFINITE, null);
+ aProject.close(null);
+ aProject.delete(true, true, null);
+ } else {
+ File f = new File(aProject.getLocation().toOSString());
+ if (f.exists()) {
+ FileUtils.delete(f, FileUtils.RECURSIVE | FileUtils.RETRY);
+ }
}
- return workDir;
- }
-
- private static void connectProjectWithRepo(IProject aProject, Repository aRepository) throws CoreException,
- IOException {
- ConnectProviderOperation op = new ConnectProviderOperation(aProject, aRepository.getDirectory());
- op.execute(null);
}
private static IJavaProject setProjectAsJava(IProject aProject) throws CoreException, IOException {
@@ -480,6 +494,65 @@ public class TestUtils {
return file;
}
+ // ------------------------------------------------------------------------
+ // Repository helper functions
+ // ------------------------------------------------------------------------
+
+ private static Repository createRepository(IProject aProject) throws CoreException, IOException {
+ TestUtils.waitForJobs();
+ File gitDir = new File(aProject.getLocation().toOSString(), Constants.DOT_GIT);
+ Repository repository = new FileRepository(gitDir);
+ try {
+ repository.create();
+ Config storedConfig = repository.getConfig();
+ storedConfig.setEnum("core", null, "autocrlf", AutoCRLF.FALSE);
+
+ } catch (IllegalStateException e) {
+ //Just go on
+ }
+ return repository;
+ }
+
+ private static void deleteRepository(Repository aRepository) throws CoreException, IOException {
+ Repository repository = aRepository;
+ repository.close();
+ repository = null;
+ }
+
+ private static void connectProjectWithRepo(IProject aProject, Repository aRepository) throws CoreException,
+ IOException {
+ ConnectProviderOperation op = new ConnectProviderOperation(aProject, aRepository.getDirectory());
+ op.execute(null);
+ }
+
+ private static void disconnectProject(IProject aProject) throws CoreException, IOException {
+ Collection<IProject> projects = Collections.singleton(aProject.getProject());
+ DisconnectProviderOperation disconnect = new DisconnectProviderOperation(projects);
+ disconnect.execute(null);
+ }
+
+ public static void addFilesToRepository(List<IResource> aResources) throws CoreException {
+ new AddToIndexOperation(aResources).execute(null);
+ }
+
+ // ------------------------------------------------------------------------
+ // Workspace helper functions
+ // ------------------------------------------------------------------------
+
+ private static String getWorkDir(Repository aRepository) throws CoreException, IOException {
+ String workDir;
+ try {
+ workDir = aRepository.getWorkTree().getCanonicalPath();
+ } catch (IOException err) {
+ workDir = aRepository.getWorkTree().getAbsolutePath();
+ }
+ workDir = workDir.replace('\\', '/');
+ if (!workDir.endsWith("/")) {
+ workDir += "/"; //$NON-NLS-1$
+ }
+ return workDir;
+ }
+
public static IFile changeContentOfFile(IFile file, String aNewContentsFilePath) throws CoreException, IOException,
URISyntaxException {
URL location = FileLocator.find(Platform.getBundle(R4EUITestPlugin.PLUGIN_ID), new Path(aNewContentsFilePath),
@@ -491,10 +564,6 @@ public class TestUtils {
return file;
}
- public static void addFilesToRepository(List<IResource> aResources) throws CoreException {
- new AddToIndexOperation(aResources).execute(null);
- }
-
public static void commitFiles(IProject aProject, Repository aRepository, String aCommitMsg) throws CoreException {
CommitOperation commitOperation = new CommitOperation(null, null, null, TestUtils.AUTHOR, TestUtils.COMMITTER,
aCommitMsg);
@@ -514,6 +583,10 @@ public class TestUtils {
aProject.refreshLocal(IResource.DEPTH_INFINITE, null);
}
+ // ------------------------------------------------------------------------
+ // Shared folder
+ // ------------------------------------------------------------------------
+
private static void setupSharedFolder() {
String dir = System.getProperty("java.io.tmpdir");
if (!dir.endsWith(File.separator)) {
@@ -523,6 +596,19 @@ public class TestUtils {
FSharedFolder = dir;
}
+ private static void cleanupSharedFolder(String aFolder) throws IOException {
+ if (null != aFolder) {
+ File f = new File(aFolder);
+ if (f.exists()) {
+ FileUtils.delete(f, FileUtils.RECURSIVE | FileUtils.RETRY);
+ }
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Review Navigator
+ // ------------------------------------------------------------------------
+
public static void startNavigatorView() {
waitForJobs();
Display.getDefault().syncExec(new Runnable() {
@@ -548,13 +634,6 @@ public class TestUtils {
});
}
- public static void cleanupTestEnvironment() throws CoreException, IOException {
- cleanupSharedFolder(FSharedFolder + File.separator);
- cleanupProject(FTextIProject, FTextRepository);
- cleanupProject(FCIProject, FCRepository);
- cleanupProject(FJavaIProject, FJavaRepository);
- }
-
public static void stopNavigatorView() {
waitForJobs();
Display.getDefault().syncExec(new Runnable() {
@@ -564,56 +643,15 @@ public class TestUtils {
});
}
- private static void cleanupProject(IProject aProject, Repository aRepository) throws CoreException, IOException {
- //Disconnect project from repository
- disconnectProject(aProject);
-
- //Delete Repository
- deleteRepository(aRepository);
-
- //Delete project
- deleteProject(aProject);
- }
-
- private static void disconnectProject(IProject aProject) throws CoreException, IOException {
- Collection<IProject> projects = Collections.singleton(aProject.getProject());
- DisconnectProviderOperation disconnect = new DisconnectProviderOperation(projects);
- disconnect.execute(null);
- }
-
- private static void deleteRepository(Repository aRepository) throws CoreException, IOException {
- Repository repository = aRepository;
- repository.close();
- repository = null;
- }
-
- private static void deleteProject(IProject aProject) throws CoreException, IOException {
- if (aProject.exists()) {
- aProject.refreshLocal(IResource.DEPTH_INFINITE, null);
- aProject.close(null);
- aProject.delete(true, true, null);
- } else {
- File f = new File(aProject.getLocation().toOSString());
- if (f.exists()) {
- FileUtils.delete(f, FileUtils.RECURSIVE | FileUtils.RETRY);
- }
- }
- }
-
- private static void cleanupSharedFolder(String aFolder) throws IOException {
- if (null != aFolder) {
- File f = new File(aFolder);
- if (f.exists()) {
- FileUtils.delete(f, FileUtils.RECURSIVE | FileUtils.RETRY);
- }
- }
- }
+ // ------------------------------------------------------------------------
+ // Misc utils
+ // ------------------------------------------------------------------------
public static void waitForJobs() {
- //NOTE: In order to the above to work, no backgroup jobs (such as Usage Data Collector) should be running.
+ //NOTE: In order to the above to work, no background jobs (such as Usage Data Collector) should be running.
//otherwise we will be blocked forever here. An alternative solution is to join our thread to the
//executing job family, but that might make the tests unreliable because we cannot control
- //scheduling of the jos which might cause livelocks
+ //scheduling of the job which might cause livelocks
while (!Job.getJobManager().isIdle()) {
delay(1000);
}
@@ -635,8 +673,12 @@ public class TestUtils {
if (null != display) {
long endTimeMillis = System.currentTimeMillis() + aWaitTimeMillis;
while (System.currentTimeMillis() < endTimeMillis) {
- if (!display.readAndDispatch()) {
- display.sleep();
+ try {
+ if (!display.isDisposed() && !display.readAndDispatch()) {
+ display.sleep();
+ }
+ } catch (Exception e) {
+ // Ignore
}
}
display.update();
@@ -650,6 +692,10 @@ public class TestUtils {
}
}
+ public static R4EUIRootElement getRootElement() {
+ return FRootElement;
+ }
+
/**
* Get the initial input from the R4E model and populate the UI model with it
*
@@ -662,10 +708,6 @@ public class TestUtils {
return rootTreeNode;
}
- public static R4EUIRootElement getRootElement() {
- return FRootElement;
- }
-
/**
* Method setDefaultUser
*/
@@ -677,4 +719,5 @@ public class TestUtils {
.getPreferencesProxy()
.getEmail());
}
+
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java
index 31d8d5d..9481a80 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java
@@ -306,9 +306,10 @@ public class R4EUIDialogFactory {
public void setChangeStateDialog(IChangeStateDialog aChangeStateDialog, Class<?> aTargetClass) {
if (aTargetClass.equals(R4EUIReviewBasic.class)) {
fChangeReviewStateDialog = aChangeStateDialog;
+ } else {
+ //Assume AnomalyChangeStateDialog
+ fChangeAnomalyStateDialog = aChangeStateDialog;
}
- //Assume AnomalyChangeStateDialog
- fChangeAnomalyStateDialog = aChangeStateDialog;
}
/**
@@ -509,7 +510,6 @@ public class R4EUIDialogFactory {
* @return IRuleInputDialog
*/
public IRuleInputDialog getRuleInputDialog(R4EDesignRuleViolation aViolation) {
-
if (null == fRuleInputDialog) {
fRuleInputDialog = new RuleInputDialog(R4EUIModelController.getNavigatorView()
.getSite()