### Question:
HexUtils { public static String integerToHexString(int value, int minBytes) { if (minBytes <= 0) throw new IllegalArgumentException("Minimum number of bytes must be greater than 0."); String f = String.format("%%0%dX", minBytes*2); return String.format(f, value); }  static String byteArrayToHexString(byte[] value); static String byteToHexString(byte value); static byte[] hexStringToByteArray(String value); static boolean containsLetters(String parameter); static String integerToHexString(int value, int minBytes); static String prettyHexString(String hexString); static String prettyHexString(byte[] value);  }### Answer:
@Test public final void testIntegerToHexStringNegativeMinBytes() { int v = 0x12345678; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Minimum number of bytes must be greater than 0."))); HexUtils.integerToHexString(v, -2); }
@Test public final void testIntegerToHexStringZeroMinBytes() { int v = 0x12345678; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Minimum number of bytes must be greater than 0."))); HexUtils.integerToHexString(v, 0); }
@Test public final void testIntegerToHexString() { int v = 0x12345678; String expectedResult = "12345678"; String result = HexUtils.integerToHexString(v, 4); assertThat("Returned string must be equal to 'expectedResult'", result, is(equalTo(expectedResult))); }
@Test public final void testIntegerToHexStringMoreBytes() { int v = 0x0000000012345678; String expectedResult = "0000000012345678"; String result = HexUtils.integerToHexString(v, 8); assertThat("Returned string must be equal to 'expectedResult'", result, is(equalTo(expectedResult))); }