### Question:
ByteUtil { public static long getValueAsLong(final byte[] key, final Map<byte[], byte[]> taskValues) { byte[] value = taskValues.get(key); if (value != null) { try { long retValue = Bytes.toLong(value); return retValue; } catch (NumberFormatException nfe) { LOG.error("Caught NFE while converting to long ", nfe); return 0L; } catch (IllegalArgumentException iae ) { LOG.error("Caught IAE while converting to long ", iae); return 0L; } } else { return 0L; } }  static byte[][] split(byte[] source, byte[] separator); static byte[][] split(byte[] source, byte[] separator, int limit); static List<Range> splitRanges(byte[] source, byte[] separator); static List<Range> splitRanges(byte[] source, byte[] separator, int limit); static byte[] join(byte[] separator, byte[]... components); static int indexOf(byte[] array, byte[] target, int fromIndex); static byte[] safeCopy(byte[] source, int offset, int length); static long getValueAsLong(final byte[] key,
      final Map<byte[], byte[]> taskValues); static String getValueAsString(final byte[] key,
      final Map<byte[], byte[]> taskValues); static double getValueAsDouble(byte[] key,
      NavigableMap<byte[], byte[]> infoValues); static int getValueAsInt(byte[] key, Map<byte[], byte[]> infoValues);  }### Answer:
@Test public void testGetValueAsLong() { NavigableMap<byte[], byte[]> infoValues = new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR); infoValues.put(JobHistoryKeys.KEYS_TO_BYTES.get(JobHistoryKeys.TOTAL_MAPS), Bytes.toBytes(JobDetailsValues.totalMaps)); long expVal = JobDetailsValues.totalMaps; assertEquals(expVal, ByteUtil.getValueAsLong(JobHistoryKeys.KEYS_TO_BYTES .get(JobHistoryKeys.TOTAL_MAPS), infoValues)); expVal = 0L; assertEquals(expVal, ByteUtil.getValueAsLong(JobHistoryKeys.KEYS_TO_BYTES .get(JobHistoryKeys.TOTAL_REDUCES), infoValues)); infoValues.put(Constants.MEGABYTEMILLIS_BYTES, Bytes.toBytes(JobDetailsValues.megabytemillis)); expVal = JobDetailsValues.megabytemillis; assertEquals(expVal, ByteUtil.getValueAsLong(Constants.MEGABYTEMILLIS_BYTES, infoValues)); expVal = 0L; assertEquals(expVal, ByteUtil.getValueAsLong(Constants.HRAVEN_QUEUE_BYTES, infoValues)); infoValues = new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR); infoValues.put(Bytes.toBytes("checking_iae"), Bytes.toBytes("abc")); assertEquals(expVal, ByteUtil.getValueAsLong(Bytes.toBytes("checking_iae"), infoValues)); }