Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2011-04-18 16:07:41 -0400
committerRyan D. Brooks2011-04-18 16:07:41 -0400
commit3c5018f5d82f7053c94a237c26babf6bb91208da (patch)
treec899bef3578c31b2b5d18e292ae6a3eff468e5f4 /plugins/org.eclipse.osee.framework.skynet.core.test
parent2a92bc7de8e3143e7b5f55814b86b02b6e833c07 (diff)
downloadorg.eclipse.osee-3c5018f5d82f7053c94a237c26babf6bb91208da.tar.gz
org.eclipse.osee-3c5018f5d82f7053c94a237c26babf6bb91208da.tar.xz
org.eclipse.osee-3c5018f5d82f7053c94a237c26babf6bb91208da.zip
feature: Support for 0 based, - delimited paragraph numbers
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core.test')
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/ReqNumberingTest.java47
1 files changed, 34 insertions, 13 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/ReqNumberingTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/ReqNumberingTest.java
index babf038c01..b3ea1de45c 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/ReqNumberingTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/ReqNumberingTest.java
@@ -12,8 +12,12 @@ package org.eclipse.osee.framework.skynet.core.importing;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import org.apache.commons.lang.StringUtils;
+import org.eclipse.osee.framework.skynet.core.importing.ReqNumbering;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -38,6 +42,24 @@ public class ReqNumberingTest {
}
@Test
+ public void testIsChild_ZeroBasedParagraphNumber() {
+ String parent = "1.3.4";
+ String child = "1.3.4.0-6";
+ ReqNumbering reqParent = new ReqNumbering(parent);
+ ReqNumbering reqChild = new ReqNumbering(child);
+ assertTrue(reqParent.isChild(reqChild));
+ }
+
+ @Test
+ public void testIsNotChild_ZeroBasedParagraphNumber() {
+ String parent = "1.3.4";
+ String child = "1.3.5.0-5";
+ ReqNumbering reqParent = new ReqNumbering(parent);
+ ReqNumbering reqChild = new ReqNumbering(child);
+ assertFalse(reqParent.isChild(reqChild));
+ }
+
+ @Test
public void testIsNotChild() {
String parent = "1.3.4";
String child = "1.3.4.6";
@@ -48,17 +70,16 @@ public class ReqNumberingTest {
@Test
public void testCompare() {
- ReqNumbering[] sequence =
- {
- new ReqNumbering("1"),
- new ReqNumbering("1.3"),
- new ReqNumbering("1.3.1.1.1.1.1.1"),
- new ReqNumbering("2.4"),
- new ReqNumbering("3")};
- for (int i = 0; i <= 2; i++) {
- assertTrue(sequence[i].compareTo(sequence[i + 1]) < 0);
- assertTrue(sequence[i + 1].compareTo(sequence[i]) > 0);
- assertTrue(sequence[i].compareTo(sequence[i]) == 0);
- }
+ List<ReqNumbering> referenceList =
+ Arrays.asList(new ReqNumbering("1"), new ReqNumbering("1.3"), new ReqNumbering("1.3.1.1.1.1.1.1"),
+ new ReqNumbering("2.4"), new ReqNumbering("2.4.0.1"), new ReqNumbering("3"));
+
+ List<ReqNumbering> sampleList =
+ Arrays.asList(new ReqNumbering("3"), new ReqNumbering("2.4.0-1"), new ReqNumbering("2.4"), new ReqNumbering(
+ "1.3.1.1.1.1.1.1"), new ReqNumbering("1.3"), new ReqNumbering("1"));
+
+ Collections.sort(sampleList);
+
+ Assert.assertEquals(referenceList, sampleList);
}
}

Back to the top