### Question:
EdgeValueHelper { public static List<Long> decodeDurationHistogram(Value value) { try { return decodeDurationHistogram(EdgeData.EdgeValue.parseFrom(value.get()).getDurationList()); } catch (InvalidProtocolBufferException e) { return decodeDurationHistogram(getVarLongList(value.get())); } } private  EdgeValueHelper(); static List<Long> decodeActivityHistogram(Value value); static List<Long> decodeActivityHistogram(List<Long> hoursList); static List<Long> decodeDurationHistogram(Value value); static List<Long> decodeDurationHistogram(List<Long> durations); static void fillHistogramGaps(List<Long> retLong, int desiredLength); static Long decodeLinkCount(final Value value); static List<Long> getVarLongList(byte[] bytes); static Value encodeActivityHistogram(List<Long> longs); static Value encodeDurationHistogram(List<Long> longs); static List<Long> getLongListForHour(int hour, boolean delete); static byte[] getByteArrayForHour(int hour, boolean delete); static List<Long> getLongListForDuration(int elapsed, boolean deleteRecord); static byte[] getByteArrayForDuration(int elapsed, boolean deleteRecord); static List<Long> initUnitList(int len, int index, boolean delete); static void combineHistogram(List<Long> sourceList, List<Long> combinedList); static final int ACTIVITY_HISTOGRAM_LENGTH; static final int DURATION_HISTOGRAM_LENGTH; }### Answer:
@Test public void testDecodeDurationHistogramWithProtoValue() { List<Long> incompleteList = createIncompleteHistogram(); EdgeData.EdgeValue.Builder builder = EdgeData.EdgeValue.newBuilder(); builder.addAllDuration(incompleteList); Value valueWithMissingDurations = new Value(builder.build().toByteArray()); List<Long> durations = EdgeValueHelper.decodeDurationHistogram(valueWithMissingDurations); verifyValuesInIncompleteHistogram(durations, EdgeValueHelper.DURATION_HISTOGRAM_LENGTH); }
@Test public void testDecodeDurationHistogramWithNonProtoValue() { List<Long> incompleteList = createIncompleteHistogram(); Value nonProtoValue = new Value(new SummingArrayCombiner.VarLongArrayEncoder().encode(incompleteList)); List<Long> durations = EdgeValueHelper.decodeDurationHistogram(nonProtoValue); verifyValuesInIncompleteHistogram(durations, EdgeValueHelper.DURATION_HISTOGRAM_LENGTH); }
@Test public void testDecodeDurationHistogramWithList() { List<Long> incompleteList = createIncompleteHistogram(); List<Long> durations = EdgeValueHelper.decodeDurationHistogram(incompleteList); verifyValuesInIncompleteHistogram(durations, EdgeValueHelper.DURATION_HISTOGRAM_LENGTH); }
@Test public void testReadNullDuration() { List<Long> oldAsList = EdgeValueHelper.decodeDurationHistogram(NULL_VALUE); assertEquals(EdgeValueHelper.DURATION_HISTOGRAM_LENGTH, oldAsList.size()); }