summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorTomasz Zarna <tomasz.zarna@tasktop.com>2012-12-10 11:20:06 +0100
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2013-01-08 06:26:36 -0500
commit928286ad8f5713dbacee033250ee63fc7072e6bc (patch)
treec15c3b1208f85cebd5518eaae78148a9fc22c3ae /org.eclipse.jgit.test/tst
parent3328f45dde327cf344bed2aa34838b777e0dd5b8 (diff)
downloadjgit-928286ad8f5713dbacee033250ee63fc7072e6bc.tar.gz
jgit-928286ad8f5713dbacee033250ee63fc7072e6bc.zip
Return info about config subsection when trying to get an invalid enum
Change-Id: Id4a72a68bdbd485619f4801683d38ad98f9841a2
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
index f02012eb5a..9836036237 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
@@ -293,6 +293,25 @@ public class ConfigTest {
}
@Test
+ public void testGetInvalidEnum() throws ConfigInvalidException {
+ Config c = parse("[a]\n\tb = invalid\n");
+ try {
+ c.getEnum("a", null, "b", TestEnum.ONE_TWO);
+ fail();
+ } catch (IllegalArgumentException e) {
+ assertEquals("Invalid value: a.b=invalid", e.getMessage());
+ }
+
+ c = parse("[a \"b\"]\n\tc = invalid\n");
+ try {
+ c.getEnum("a", "b", "c", TestEnum.ONE_TWO);
+ fail();
+ } catch (IllegalArgumentException e) {
+ assertEquals("Invalid value: a.b.c=invalid", e.getMessage());
+ }
+ }
+
+ @Test
public void testSetEnum() {
final Config c = new Config();
c.setEnum("s", "b", "c", TestEnum.ONE_TWO);