diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestTruncateQuotaUpdate.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestTruncateQuotaUpdate.java index fcdd6509114..f200d5edd75 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestTruncateQuotaUpdate.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestTruncateQuotaUpdate.java @@ -22,6 +22,8 @@ import org.apache.hadoop.fs.permission.PermissionStatus; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo; import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoContiguous; +import org.apache.hadoop.hdfs.server.namenode.snapshot.DiffList; +import org.apache.hadoop.hdfs.server.namenode.snapshot.DiffListByArrayList; import org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiff; import org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiffList; import org.apache.hadoop.hdfs.server.namenode.snapshot.FileWithSnapshotFeature; @@ -156,11 +158,11 @@ public class TestTruncateQuotaUpdate { FileDiff diff = mock(FileDiff.class); when(diff.getBlocks()).thenReturn(blocks); FileDiffList diffList = new FileDiffList(); - Whitebox.setInternalState(diffList, "diffs", new ArrayList()); + Whitebox.setInternalState(diffList, "diffs", new DiffListByArrayList<>(0)); @SuppressWarnings("unchecked") - ArrayList diffs = ((ArrayList)Whitebox.getInternalState - (diffList, "diffs")); - diffs.add(diff); + DiffList diffs = (DiffList)Whitebox.getInternalState( + diffList, "diffs"); + diffs.addFirst(diff); FileWithSnapshotFeature sf = new FileWithSnapshotFeature(diffList); file.addFeature(sf); }