summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2009-09-03 12:46:31 +0200
committerShawn O. Pearce <spearce@spearce.org>2009-10-06 07:42:49 -0700
commit9c056fcace49f4c111cad8a49399a113fb083f30 (patch)
treeac9ac1851e459649fc31c1341387a561909e9705 /org.eclipse.jgit.test/tst/org/eclipse/jgit
parent6e1571d5b9269ec79eadad0dbd5916508a4fee82 (diff)
downloadjgit-9c056fcace49f4c111cad8a49399a113fb083f30.tar.gz
jgit-9c056fcace49f4c111cad8a49399a113fb083f30.zip
Add set to IntList
Some applications may wish to modify an int list. Bug: 291083 Eclipse-CQ: 3559 Change-Id: Iea871443ec661230aec92397229f1eda6c74216f Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/IntListTest.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/IntListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/IntListTest.java
index ecabeeea5b..b8d5bd1025 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/IntListTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/IntListTest.java
@@ -150,6 +150,27 @@ public class IntListTest extends TestCase {
}
}
+ public void testSet() {
+ final IntList i = new IntList();
+ i.add(1);
+ assertEquals(1, i.size());
+ assertEquals(1, i.get(0));
+
+ i.set(0, 5);
+ assertEquals(5, i.get(0));
+
+ try {
+ i.set(5, 5);
+ fail("accepted set of 5 beyond end of list");
+ } catch (ArrayIndexOutOfBoundsException e){
+ assertTrue(true);
+ }
+
+ i.set(1, 2);
+ assertEquals(2, i.size());
+ assertEquals(2, i.get(1));
+ }
+
public void testToString() {
final IntList i = new IntList();
i.add(1);