1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.internal.transport.parser;
12
13 import static org.junit.Assert.assertEquals;
14 import static org.junit.Assert.assertTrue;
15
16 import java.util.Map;
17
18 import org.junit.Test;
19
20 public class FirstCommandTest {
21 @Test
22 public void testClientSID() {
23 String oldStr = "0000000000000000000000000000000000000000";
24 String newStr = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
25 String refName = "refs/heads/master";
26 String command = oldStr + " " + newStr + " " + refName;
27 String fl = command + "\0"
28 + "some capabilities session-id=the-clients-SID and more unknownCap=some-value";
29 FirstCommand fc = FirstCommand.fromLine(fl);
30
31 Map<String, String> options = fc.getCapabilities();
32
33 assertEquals("the-clients-SID", options.get("session-id"));
34 assertEquals(command, fc.getLine());
35 assertTrue(options.containsKey("unknownCap"));
36 assertEquals(6, options.size());
37 }
38 }