### Question:
ByteUtils { public static boolean isBitEnabled(int containerInteger, int bitPosition) { if (bitPosition < 0 || bitPosition > 31) throw new IllegalArgumentException("Bit position must be between 0 and 31."); return (((containerInteger & 0xFFFFFFFF) >> bitPosition) & 0x01) == 0x01; }  static byte[] readBytes(int numBytes, ByteArrayInputStream inputStream); static String readString(ByteArrayInputStream inputStream); static byte[] longToByteArray(long value); static long byteArrayToLong(byte[] byteArray); static byte[] intToByteArray(int value); static int byteArrayToInt(byte[] byteArray); static byte[] shortToByteArray(short value); static short byteArrayToShort(byte[] byteArray); static byte[] stringToByteArray(String value); static String byteArrayToString(byte[] value); static int byteToInt(byte b); static boolean isBitEnabled(int containerInteger, int bitPosition); static int readIntegerFromByte(byte containerByte, int bitOffset, int bitLength); static boolean readBooleanFromByte(byte containerByte, int bitOffset); static byte[] readUntilCR(ByteArrayInputStream inputStream); static byte[] newByteArray(byte[] data, int finalSize); static byte[] swapByteArray(byte[] source);  }### Answer:
@Test public final void testIsBitEnabledNegativePosition() { int n = 0xFFFF; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Bit position must be between 0 and 31."))); ByteUtils.isBitEnabled(n, -9); }
@Test public final void testIsBitEnabledPositionGreaterThanValid() { int n = 0xFFFF; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Bit position must be between 0 and 31."))); ByteUtils.isBitEnabled(n, 400); }
@Test public final void testIsBitEnabledTrue() { int n = 0xFFFF; boolean expectedResult = true; boolean result = ByteUtils.isBitEnabled(n, 5); assertThat("Bit must be enabled", result, is(equalTo(expectedResult))); }
@Test public final void testIsBitEnabledFalse() { int n = 0x0; boolean expectedResult = false; boolean result = ByteUtils.isBitEnabled(n, 5); assertThat("Bit must be disabled", result, is(equalTo(expectedResult))); }