Move logic from GitWebType to GitWebConfig
GitWebType is a dumb POJO. Initialization of this type was split across GitWebType and GitWebConfig for no strong reason, possibly related to the fact that GitWebType is in the gerrit-common package and so can't depend on the JGit Config object. The setters of GitWebType weren't behaving like normal POJO setters, as they were ignoring null or empty values. Get rid of this special-casing behavior, which made the behavior of GitWebConfig difficult to understand. Instead, move all the construction of a GitWebType to GitWebConfig, which is a server-side class and can handle the Config parsing as well as the named default configurations. Change-Id: I119778c3ab3b791fbf363e2d87818e40dc9687b6
This commit is contained in:
		| @@ -19,21 +19,15 @@ import static org.junit.Assert.assertEquals; | ||||
| import org.junit.Test; | ||||
|  | ||||
| public class EncodePathSeparatorTest { | ||||
|  | ||||
|   @Test | ||||
|   public void testDefaultBehaviour() { | ||||
|  | ||||
|     GitWebType gitWebType = GitWebType.fromName(null); | ||||
|  | ||||
|     assertEquals("a/b", gitWebType.replacePathSeparator("a/b")); | ||||
|     assertEquals("a/b", new GitWebType().replacePathSeparator("a/b")); | ||||
|   } | ||||
|  | ||||
|   @Test | ||||
|   public void testExclamationMark() { | ||||
|  | ||||
|     GitWebType gitWebType = GitWebType.fromName(null); | ||||
|     GitWebType gitWebType = new GitWebType(); | ||||
|     gitWebType.setPathSeparator('!'); | ||||
|  | ||||
|     assertEquals("a!b", gitWebType.replacePathSeparator("a/b")); | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dave Borowitz
					Dave Borowitz