Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2012-07-26 06:51:57 +0000
committerkwilk2012-07-27 21:07:40 +0000
commit4f9877fe6485d5a842567311d787bf94fc588f92 (patch)
treeddb4271a2990a851918acf4a1890bbe8f7f2d25d /plugins/org.eclipse.osee.framework.skynet.core.test
parentdf05fb4b1a8c5af1b112221bde7470e5f625342a (diff)
downloadorg.eclipse.osee-4f9877fe6485d5a842567311d787bf94fc588f92.tar.gz
org.eclipse.osee-4f9877fe6485d5a842567311d787bf94fc588f92.tar.xz
org.eclipse.osee-4f9877fe6485d5a842567311d787bf94fc588f92.zip
feature[ats_72MWE]: Importer improvement to handle more 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/parsers/OutlineResolutionAndNumberTest.java58
1 files changed, 44 insertions, 14 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/OutlineResolutionAndNumberTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/OutlineResolutionAndNumberTest.java
index 126b9e9eeff..ab5b51ffdab 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/OutlineResolutionAndNumberTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/parsers/OutlineResolutionAndNumberTest.java
@@ -18,8 +18,6 @@ import org.junit.Assert;
import org.junit.Test;
/**
- * Asserting true in general means GUI should be called for user to make decision; false - opposite
- *
* @author Karol M. Wilk
*/
public final class OutlineResolutionAndNumberTest {
@@ -77,44 +75,68 @@ public final class OutlineResolutionAndNumberTest {
public void testNextSetGeneration() {
Set<String> nextPossibleSet = outlineResolution.generateNextSet(new ReqNumbering(LAST_OUTLINE_NUMBER));
Set<String> expected =
- new HashSet<String>(Arrays.asList("3.2", "3.1.2", "3.1.1.3", "3.1.1.2.2", "3.1.1.2.1.8", "4.", "4.0",
+ new HashSet<String>(Arrays.asList("3.2", "3.1.2", "3.1.1.3", "3.1.1.2.2", "3.1.1.2.1.8", "4.0",
"3.1.1.2.1.7.1", "3.1.1.2.1.7.0.1"));
- Assert.assertEquals(expected, nextPossibleSet);
+ addDotEndingSet(expected);
+ expected.removeAll(nextPossibleSet);
+ Assert.assertTrue(expected.isEmpty());
}
+ /**
+ * <p>
+ * Generate next numbers with ending "." by default.
+ *
+ * <pre>
+ * input(current number) output(generated set)
+ * 1. -> [1.1, 1.1., 1.0.1., 1.0.1, 2.0, 2.0.]
+ * 3. -> [3.0.1, 3.0.1., 3.1, 3.1., 4.0, 4.0.]
+ * </pre>
+ *
+ * </p>
+ */
@Test
public void testNextSetGeneration_NonZeroBased() {
Set<String> nextPossibleSet = outlineResolution.generateNextSet(new ReqNumbering("1."));
- Set<String> expected = new HashSet<String>(Arrays.asList("2.", "2.0", "1.1", "1.0.1"));
- Assert.assertEquals(expected, nextPossibleSet);
+ Set<String> expected = new HashSet<String>(Arrays.asList("2.0", "1.1", "1.0.1"));
+ addDotEndingSet(expected);
+ expected.removeAll(nextPossibleSet);
+ Assert.assertTrue(expected.isEmpty());
}
@Test
public void testNextSetGeneration_ZeroBased() {
Set<String> nextPossibleSet = outlineResolution.generateNextSet(new ReqNumbering("1.0"));
- Set<String> expected = new HashSet<String>(Arrays.asList("2.", "2.0", "1.1", "1.0.1"));
- Assert.assertEquals(expected, nextPossibleSet);
+ Set<String> expected = new HashSet<String>(Arrays.asList("2.0", "1.1", "1.0.1"));
+ addDotEndingSet(expected);
+ expected.removeAll(nextPossibleSet);
+ Assert.assertTrue(expected.isEmpty());
}
@Test
public void testNextSetGeneration_ZeroExtendedBased() {
Set<String> nextPossibleSet = outlineResolution.generateNextSet(new ReqNumbering("1.0.1"));
- Set<String> expected = new HashSet<String>(Arrays.asList("2.", "2.0", "1.1", "1.0.2"));
- Assert.assertEquals(expected, nextPossibleSet);
+ Set<String> expected = new HashSet<String>(Arrays.asList("2.0", "1.1", "1.0.2"));
+ addDotEndingSet(expected);
+ expected.removeAll(nextPossibleSet);
+ Assert.assertTrue(expected.isEmpty());
}
@Test
public void testNextSetGeneration_DoubleDigitZeroBased() {
Set<String> nextPossibleSet = outlineResolution.generateNextSet(new ReqNumbering("1.0.10"));
- Set<String> expected = new HashSet<String>(Arrays.asList("2.", "2.0", "1.1", "1.0.11", "1.0.10.1", "1.0.10.0.1"));
- Assert.assertEquals(expected, nextPossibleSet);
+ Set<String> expected = new HashSet<String>(Arrays.asList("2.0", "1.1", "1.0.11", "1.0.10.1", "1.0.10.0.1"));
+ addDotEndingSet(expected);
+ expected.removeAll(nextPossibleSet);
+ Assert.assertTrue(expected.isEmpty());
}
@Test
public void testNextSetGeneration_DoubleDigitHigherBased() {
Set<String> nextPossibleSet = outlineResolution.generateNextSet(new ReqNumbering("1.23"));
- Set<String> expected = new HashSet<String>(Arrays.asList("2.", "2.0", "1.24", "1.23.1", "1.23.0.1"));
- Assert.assertEquals(expected, nextPossibleSet);
+ Set<String> expected = new HashSet<String>(Arrays.asList("2.0", "1.24", "1.23.1", "1.23.0.1"));
+ addDotEndingSet(expected);
+ expected.removeAll(nextPossibleSet);
+ Assert.assertTrue(expected.isEmpty());
}
@Test
@@ -132,4 +154,12 @@ public final class OutlineResolutionAndNumberTest {
larger_NotGenerated_CorrectInvalid = outlineResolution.isInvalidOutlineNumber("1.23.1.0.0.0.1", "1.23");
Assert.assertFalse(larger_NotGenerated_CorrectInvalid);
}
+
+ private void addDotEndingSet(Set<String> inputSet) {
+ Set<String> dotEnding = new HashSet<String>(inputSet.size());
+ for (String item : inputSet) {
+ dotEnding.add(item + ".");
+ }
+ inputSet.addAll(dotEnding);
+ }
}

Back to the top