1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.lfs.lib;
11
12 import static org.junit.Assert.assertEquals;
13
14 import org.junit.Test;
15
16
17
18
19 public class MutableLongObjectIdTest {
20
21 @Test
22 public void testFromRawLong() {
23 MutableLongObjectId m = new MutableLongObjectId();
24 m.fromRaw(new long[] { 1L, 2L, 3L, 4L });
25 assertEquals(new LongObjectId(1L, 2L, 3L, 4L), m);
26 }
27
28 @Test
29 public void testFromString() {
30 AnyLongObjectId id = new LongObjectId(1L, 2L, 3L, 4L);
31 MutableLongObjectId m = new MutableLongObjectId();
32 m.fromString(id.name());
33 assertEquals(id, m);
34 }
35
36 @Test
37 public void testFromStringByte() {
38 AnyLongObjectId id = new LongObjectId(1L, 2L, 3L, 4L);
39 MutableLongObjectId m = new MutableLongObjectId();
40 byte[] buf = new byte[64];
41 id.copyTo(buf, 0);
42 m.fromString(buf, 0);
43 assertEquals(id, m);
44 }
45
46 @Test
47 public void testCopy() {
48 MutableLongObjectId m = new MutableLongObjectId();
49 m.fromRaw(new long[] { 1L, 2L, 3L, 4L });
50 assertEquals(m, new MutableLongObjectId(m));
51 }
52
53 @Test
54 public void testToObjectId() {
55 MutableLongObjectId m = new MutableLongObjectId();
56 m.fromRaw(new long[] { 1L, 2L, 3L, 4L });
57 assertEquals(m, m.toObjectId());
58 }
59 }