1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.lfs.lib;
12
13 import static java.nio.charset.StandardCharsets.UTF_8;
14 import static org.junit.Assert.assertEquals;
15
16 import java.io.ByteArrayOutputStream;
17 import java.io.IOException;
18
19 import org.eclipse.jgit.lfs.LfsPointer;
20 import org.junit.Test;
21
22
23
24
25 public class LFSPointerTest {
26 @Test
27 public void testEncoding() throws IOException {
28 final String s = "27e15b72937fc8f558da24ac3d50ec20302a4cf21e33b87ae8e4ce90e89c4b10";
29 AnyLongObjectId id = LongObjectId.fromString(s);
30 LfsPointer ptr = new LfsPointer(id, 4);
31 try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
32 ptr.encode(baos);
33 assertEquals(
34 "version https://git-lfs.github.com/spec/v1\noid sha256:"
35 + s + "\nsize 4\n",
36 baos.toString(UTF_8.name()));
37 }
38 }
39 }