@@ -0,0 +1,2640 @@
+package net.onrc.onos.core.datastore.utils;%0A%0Aimport org.hamcrest.MatcherAssert;%0Aimport org.junit.Test;%0A%0Aimport static net.onrc.onos.core.util.UtilityClassChecker.assertThatClassIsUtility;%0Aimport static org.hamcrest.Matchers.equalTo;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.hamcrest.Matchers.notNullValue;%0A%0A/**%0A * Test cases for the ByteArrayUtil class.%0A */%0A%0Apublic class ByteArrayUtilTest %7B%0A%0A    /**%0A     * Make sure that the ByteArrayUtil class is a utility class.%0A     */%0A    @Test%0A    public void testForWellDefinedUtilityClass() throws Exception %7B%0A        assertThatClassIsUtility(ByteArrayUtil.class);%0A    %7D%0A%0A    /**%0A     * Test that when given a null array for the bytes to convert, the hex%0A     * conversion routines return an empty StringBuilder.%0A     */%0A    @Test%0A    public void testToHexStringBuilderNullParameter() %7B%0A        final StringBuilder allocatedBuilder =%0A                ByteArrayUtil.toHexStringBuilder(null, %22%22);%0A        MatcherAssert.assertThat(allocatedBuilder, is(notNullValue()));%0A        MatcherAssert.assertThat(allocatedBuilder.toString(), is(equalTo(%22%22)));%0A%0A        final StringBuilder providedBuilder = new StringBuilder();%0A        final StringBuilder returnedBuilder = ByteArrayUtil.toHexStringBuilder%0A                (null, %22%22, providedBuilder);%0A        MatcherAssert.assertThat(providedBuilder, is(notNullValue()));%0A        MatcherAssert.assertThat(returnedBuilder, is(equalTo(providedBuilder)));%0A        MatcherAssert.assertThat(providedBuilder.toString(), is(equalTo(%22%22)));%0A    %7D%0A%0A    /**%0A     * Test the array byte to String conversion routines to be sure the data%0A     * is converted properly.%0A     */%0A    @Test%0A    public void testToHexStringBuilder() %7B%0A        final byte%5B%5D testData = %7B0x1,  0x2,  0x3,  0x4,  0x5,%0A                                 0x3b, 0x3c, 0x3d, 0x3e, 0x3f%7D;%0A        final String expectedResult = %221:2:3:4:5:3b:3c:3d:3e:3f%22;%0A%0A        final StringBuilder result =%0A                ByteArrayUtil.toHexStringBuilder(testData, %22:%22);%0A%0A        MatcherAssert.assertThat(result, is(notNullValue()));%0A        MatcherAssert.assertThat(result.toString(),%0A                is(equalTo(expectedResult)));%0A        %0A        final StringBuilder providedBuilder = new StringBuilder();%0A        final StringBuilder returnedBuilder =%0A                ByteArrayUtil.toHexStringBuilder(testData, %22:%22, providedBuilder);%0A%0A        MatcherAssert.assertThat(returnedBuilder, is(notNullValue()));%0A        MatcherAssert.assertThat(returnedBuilder, is(equalTo(providedBuilder)));%0A        MatcherAssert.assertThat(returnedBuilder.toString(),%0A                is(equalTo(expectedResult)));%0A    %7D%0A%7D%0A

Add a unit test for the ByteArrayUtil class