aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/lib')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdTest.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdTest.java
index abf57d6cd3..2198b87aa5 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdTest.java
@@ -49,6 +49,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import org.eclipse.jgit.errors.InvalidObjectIdException;
+
import org.junit.Test;
public class ObjectIdTest {
@@ -124,6 +126,21 @@ public class ObjectIdTest {
assertEquals(x.toLowerCase(), oid.name());
}
+ @Test(expected = InvalidObjectIdException.class)
+ public void testFromString_short() {
+ ObjectId.fromString("cafe1234");
+ }
+
+ @Test(expected = InvalidObjectIdException.class)
+ public void testFromString_nonHex() {
+ ObjectId.fromString("0123456789abcdefghij0123456789abcdefghij");
+ }
+
+ @Test(expected = InvalidObjectIdException.class)
+ public void testFromString_shortNonHex() {
+ ObjectId.fromString("6789ghij");
+ }
+
@Test
public void testGetByte() {
byte[] raw = new byte[20];