1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.lib;
12
13 import static org.junit.Assert.assertEquals;
14 import static org.junit.Assert.assertFalse;
15 import static org.junit.Assert.assertTrue;
16
17 import org.eclipse.jgit.lib.SubmoduleConfig.FetchRecurseSubmodulesMode;
18 import org.junit.Test;
19
20 public class SubmoduleConfigTest {
21 @Test
22 public void fetchRecurseMatch() throws Exception {
23 assertTrue(FetchRecurseSubmodulesMode.YES.matchConfigValue("yes"));
24 assertTrue(FetchRecurseSubmodulesMode.YES.matchConfigValue("YES"));
25 assertTrue(FetchRecurseSubmodulesMode.YES.matchConfigValue("true"));
26 assertTrue(FetchRecurseSubmodulesMode.YES.matchConfigValue("TRUE"));
27
28 assertTrue(FetchRecurseSubmodulesMode.ON_DEMAND
29 .matchConfigValue("on-demand"));
30 assertTrue(FetchRecurseSubmodulesMode.ON_DEMAND
31 .matchConfigValue("ON-DEMAND"));
32 assertTrue(FetchRecurseSubmodulesMode.ON_DEMAND
33 .matchConfigValue("on_demand"));
34 assertTrue(FetchRecurseSubmodulesMode.ON_DEMAND
35 .matchConfigValue("ON_DEMAND"));
36
37 assertTrue(FetchRecurseSubmodulesMode.NO.matchConfigValue("no"));
38 assertTrue(FetchRecurseSubmodulesMode.NO.matchConfigValue("NO"));
39 assertTrue(FetchRecurseSubmodulesMode.NO.matchConfigValue("false"));
40 assertTrue(FetchRecurseSubmodulesMode.NO.matchConfigValue("FALSE"));
41 }
42
43 @Test
44 public void fetchRecurseNoMatch() throws Exception {
45 assertFalse(FetchRecurseSubmodulesMode.YES.matchConfigValue("Y"));
46 assertFalse(FetchRecurseSubmodulesMode.NO.matchConfigValue("N"));
47 assertFalse(FetchRecurseSubmodulesMode.ON_DEMAND
48 .matchConfigValue("ONDEMAND"));
49 assertFalse(FetchRecurseSubmodulesMode.YES.matchConfigValue(""));
50 assertFalse(FetchRecurseSubmodulesMode.YES.matchConfigValue(null));
51 }
52
53 @Test
54 public void fetchRecurseToConfigValue() {
55 assertEquals("on-demand",
56 FetchRecurseSubmodulesMode.ON_DEMAND.toConfigValue());
57 assertEquals("true", FetchRecurseSubmodulesMode.YES.toConfigValue());
58 assertEquals("false", FetchRecurseSubmodulesMode.NO.toConfigValue());
59 }
60 }