|
20 | 20 |
|
21 | 21 | package com.arangodb.velocypack;
|
22 | 22 |
|
23 |
| -import static org.hamcrest.Matchers.is; |
24 |
| -import static org.junit.Assert.*; |
| 23 | +import com.arangodb.velocypack.exception.VPackException; |
| 24 | +import com.arangodb.velocypack.exception.VPackValueTypeException; |
| 25 | +import org.junit.Test; |
25 | 26 |
|
26 | 27 | import java.math.BigInteger;
|
27 | 28 | import java.util.Arrays;
|
|
30 | 31 | import java.util.Iterator;
|
31 | 32 | import java.util.Map.Entry;
|
32 | 33 |
|
33 |
| -import org.junit.Test; |
34 |
| - |
35 |
| -import com.arangodb.velocypack.exception.VPackException; |
36 |
| -import com.arangodb.velocypack.exception.VPackValueTypeException; |
| 34 | +import static org.hamcrest.Matchers.is; |
| 35 | +import static org.junit.Assert.*; |
37 | 36 |
|
38 | 37 | /**
|
39 | 38 | * @author Mark Vollmary
|
@@ -401,27 +400,28 @@ private void checkBCD(final byte[] vpack) {
|
401 | 400 |
|
402 | 401 | @Test
|
403 | 402 | public void isCustom() {
|
404 |
| - checkCustom(new byte[] { (byte) 0xf0 }); |
405 |
| - checkCustom(new byte[] { (byte) 0xf1 }); |
406 |
| - checkCustom(new byte[] { (byte) 0xf2 }); |
407 |
| - checkCustom(new byte[] { (byte) 0xf3 }); |
408 |
| - checkCustom(new byte[] { (byte) 0xf4 }); |
409 |
| - checkCustom(new byte[] { (byte) 0xf5 }); |
410 |
| - checkCustom(new byte[] { (byte) 0xf6 }); |
411 |
| - checkCustom(new byte[] { (byte) 0xf7 }); |
412 |
| - checkCustom(new byte[] { (byte) 0xf8 }); |
413 |
| - checkCustom(new byte[] { (byte) 0xf9 }); |
414 |
| - checkCustom(new byte[] { (byte) 0xfa }); |
415 |
| - checkCustom(new byte[] { (byte) 0xfb }); |
416 |
| - checkCustom(new byte[] { (byte) 0xfc }); |
417 |
| - checkCustom(new byte[] { (byte) 0xfd }); |
418 |
| - checkCustom(new byte[] { (byte) 0xfe }); |
419 |
| - checkCustom(new byte[] { (byte) 0xff }); |
420 |
| - } |
421 |
| - |
422 |
| - private void checkCustom(final byte[] vpack) { |
| 403 | + checkCustom(new byte[] { (byte) 0xf0 }, 2); |
| 404 | + checkCustom(new byte[] { (byte) 0xf1 }, 3); |
| 405 | + checkCustom(new byte[] { (byte) 0xf2 }, 5); |
| 406 | + checkCustom(new byte[] { (byte) 0xf3 }, 9); |
| 407 | + checkCustom(new byte[] { (byte) 0xf4, (byte) 0x00 }, 2); |
| 408 | + checkCustom(new byte[] { (byte) 0xf5, (byte) 0x01 }, 3); |
| 409 | + checkCustom(new byte[] { (byte) 0xf6, (byte) 0x02 }, 4); |
| 410 | + checkCustom(new byte[] { (byte) 0xf7, (byte) 0x00, (byte) 0x00 }, 3); |
| 411 | + checkCustom(new byte[] { (byte) 0xf8, (byte) 0x01, (byte) 0x00 }, 4); |
| 412 | + checkCustom(new byte[] { (byte) 0xf9, (byte) 0x02, (byte) 0x00 }, 5); |
| 413 | + checkCustom(new byte[] { (byte) 0xfa, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }, 5); |
| 414 | + checkCustom(new byte[] { (byte) 0xfb, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00 }, 6); |
| 415 | + checkCustom(new byte[] { (byte) 0xfc, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00 }, 7); |
| 416 | + checkCustom(new byte[] { (byte) 0xfd, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }, 9); |
| 417 | + checkCustom(new byte[] { (byte) 0xfe, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }, 10); |
| 418 | + checkCustom(new byte[] { (byte) 0xff, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }, 11); |
| 419 | + } |
| 420 | + |
| 421 | + private void checkCustom(final byte[] vpack, final int expectedSize) { |
423 | 422 | final VPackSlice slice = new VPackSlice(vpack);
|
424 | 423 | assertThat(slice.isCustom(), is(true));
|
| 424 | + assertThat(slice.getByteSize(), is(expectedSize)); |
425 | 425 | }
|
426 | 426 |
|
427 | 427 | @Test
|
|
0 commit comments