From: Marek Zawirski <marek.zawirski@xxxxxxxxx> Add cases for getting values after setting them. It's something different from reading config file from scratch or writing it out after modifications. It's case for getting values after modifications in object model. Signed-off-by: Marek Zawirski <marek.zawirski@xxxxxxxxx> Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- .../org/spearce/jgit/lib/RepositoryConfigTest.java | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryConfigTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryConfigTest.java index 8c55fe8..da7e704 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryConfigTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryConfigTest.java @@ -2,6 +2,7 @@ * Copyright (C) 2007, Dave Watson <dwatson@xxxxxxxxxxxx> * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> * Copyright (C) 2008, Shawn O. Pearce <spearce@xxxxxxxxxxx> + * Copyright (C) 2008, Marek Zawirski <marek.zawirski@xxxxxxxxx> * * All rights reserved. * @@ -41,6 +42,8 @@ package org.spearce.jgit.lib; import java.io.File; import java.io.IOException; +import java.util.Arrays; +import java.util.LinkedList; /** * Test reading of git config @@ -84,11 +87,26 @@ public class RepositoryConfigTest extends RepositoryTestCase { checkFile(cfgFile, "[sec \"ext\"]\n\tname = value\n\tname2 = value2\n"); } - public void test004_PutSimple() throws IOException { + public void test004_PutGetSimple() throws IOException { File cfgFile = writeTrashFile("config_004", ""); RepositoryConfig repositoryConfig = new RepositoryConfig(null, cfgFile); repositoryConfig.setString("my", null, "somename", "false"); repositoryConfig.save(); checkFile(cfgFile, "[my]\n\tsomename = false\n"); + assertEquals("false", repositoryConfig + .getString("my", null, "somename")); + } + + public void test005_PutGetStringList() throws IOException { + File cfgFile = writeTrashFile("config_005", ""); + RepositoryConfig repositoryConfig = new RepositoryConfig(null, cfgFile); + final LinkedList<String> values = new LinkedList<String>(); + values.add("value1"); + values.add("value2"); + repositoryConfig.setStringList("my", null, "somename", values); + repositoryConfig.save(); + assertTrue(Arrays.equals(values.toArray(), repositoryConfig + .getStringList("my", null, "somename"))); + checkFile(cfgFile, "[my]\n\tsomename = value1\n\tsomename = value2\n"); } } -- 1.6.0.rc0.182.gb96c7 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html