1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.transport;
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.transport.PushConfig.PushRecurseSubmodulesMode;
18 import org.junit.Test;
19
20 public class PushConfigTest {
21 @Test
22 public void pushRecurseSubmoduleMatch() throws Exception {
23 assertTrue(PushRecurseSubmodulesMode.CHECK.matchConfigValue("check"));
24 assertTrue(PushRecurseSubmodulesMode.CHECK.matchConfigValue("CHECK"));
25
26 assertTrue(PushRecurseSubmodulesMode.ON_DEMAND
27 .matchConfigValue("on-demand"));
28 assertTrue(PushRecurseSubmodulesMode.ON_DEMAND
29 .matchConfigValue("ON-DEMAND"));
30 assertTrue(PushRecurseSubmodulesMode.ON_DEMAND
31 .matchConfigValue("on_demand"));
32 assertTrue(PushRecurseSubmodulesMode.ON_DEMAND
33 .matchConfigValue("ON_DEMAND"));
34
35 assertTrue(PushRecurseSubmodulesMode.NO.matchConfigValue("no"));
36 assertTrue(PushRecurseSubmodulesMode.NO.matchConfigValue("NO"));
37 assertTrue(PushRecurseSubmodulesMode.NO.matchConfigValue("false"));
38 assertTrue(PushRecurseSubmodulesMode.NO.matchConfigValue("FALSE"));
39 }
40
41 @Test
42 public void pushRecurseSubmoduleNoMatch() throws Exception {
43 assertFalse(PushRecurseSubmodulesMode.NO.matchConfigValue("N"));
44 assertFalse(PushRecurseSubmodulesMode.ON_DEMAND
45 .matchConfigValue("ONDEMAND"));
46 }
47
48 @Test
49 public void pushRecurseSubmoduleToConfigValue() {
50 assertEquals("on-demand",
51 PushRecurseSubmodulesMode.ON_DEMAND.toConfigValue());
52 assertEquals("check", PushRecurseSubmodulesMode.CHECK.toConfigValue());
53 assertEquals("false", PushRecurseSubmodulesMode.NO.toConfigValue());
54 }
55 }