package com.heartbeat.common.array;

import org.junit.Test;


public class ByteArrayTest {

    @Test
    public void testTrim() throws Exception {
        byte[] original = {1, 2, 3, 4, 0, 0, 0, 0};
        byte[] trimmed = ByteArray.trim(original);
        assert trimmed.length == 4;

        byte[] original2 = {1, 2, 3, 4, 0, 0, 0, 1};
        trimmed = ByteArray.trim(original2);
        assert trimmed.length == 8;

    }
}
@@ -421,10 +421,317 @@
 ;%0A%0A    %7D
+%0A%0A    @Test%0A    public void testTrimEmptyArray() throws Exception %7B%0A        byte%5B%5D original = %7B%7D;%0A        byte%5B%5D trimmed = ByteArray.trim(original);%0A        assert trimmed.length == 0;%0A%0A        byte%5B%5D original2 = %7B0, 0%7D;%0A        trimmed = ByteArray.trim(original2);%0A        assert trimmed.length == 0;%0A    %7D
 %0A%7D

Add test for Trim() on an empty ByteArray.