### Question:
ByteArray implements Comparable<ByteArray> { @Override public boolean equals(Object thatObject) { if (this == thatObject) return true; else { if (!(thatObject instanceof ByteArray)) throw new IllegalArgumentException("Is not ByteArray: " + thatObject); else { ByteArray that = (ByteArray)thatObject; return this.compareTo(that) == 0; } } } ByteArray(byte... a); byte[] byteArrayValue(); @Override boolean equals(Object thatObject); @Override int hashCode(); @Override String toString(); @Override int compareTo(ByteArray that);  }### Answer:
@Test public void testEqualsForFirstArrayShorter() { byte[] a = new byte[] {1, 2}; byte[] b = new byte[] {1, 2, 3}; assertEquals(new ByteArray(a).equals(new ByteArray(b)), Arrays.equals(a, b)); }
@Test public void testEqualsForSecondArrayShorter() { byte[] a = new byte[] {1, 2, 3}; byte[] b = new byte[] {1, 2}; assertEquals(new ByteArray(a).equals(new ByteArray(b)), Arrays.equals(a, b)); }
@Test public void testEqualsForEmptyArrays() { byte[] a = new byte[] {}; byte[] b = new byte[] {}; assertEquals(new ByteArray(a).equals(new ByteArray(b)), Arrays.equals(a, b)); }
@Test public void testEqualsForEqualArrays() { byte[] a = new byte[] {1, 2, 3}; byte[] b = new byte[] {1, 2, 3}; assertEquals(new ByteArray(a).equals(new ByteArray(b)), Arrays.equals(a, b)); }
@Test public void testEqualsForNotEqualArrays() { byte[] a = new byte[] {1, 2, 3}; byte[] b = new byte[] {2, 3, 1}; assertEquals(new ByteArray(a).equals(new ByteArray(b)), Arrays.equals(a, b)); }