@@ -0,0 +1,2604 @@
+/*%0A * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0%0A * (the %22License%22). You may not use this work except in compliance with the License, which is%0A * available at www.apache.org/licenses/LICENSE-2.0%0A *%0A * This software is distributed on an %22AS IS%22 basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,%0A * either express or implied, as more fully set forth in the License.%0A *%0A * See the NOTICE file distributed with this work for information regarding copyright ownership.%0A */%0A%0Apackage alluxio.client.file.cache;%0A%0Aimport alluxio.ConfigurationTestUtils;%0Aimport alluxio.client.file.cache.evictor.FIFOEvictor;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0A/**%0A * Tests for the %7B@link FIFOEvictor%7D class.%0A */%0Apublic final class FIFOEvictorTest %7B%0A  private FIFOEvictor mEvictor;%0A  private final PageId mFirst = new PageId(%221L%22, 2L);%0A  private final PageId mSecond = new PageId(%223L%22, 4L);%0A  private final PageId mThird = new PageId(%225L%22, 6L);%0A  private final PageId mFourth = new PageId(%227L%22, 8L);%0A%0A  /**%0A   * Sets up the instances.%0A   */%0A  @Before%0A  public void before() %7B%0A    mEvictor = new FIFOEvictor(ConfigurationTestUtils.defaults());%0A  %7D%0A%0A  @Test%0A  public void evictPutOrder() %7B%0A    mEvictor.updateOnPut(mFirst);%0A    mEvictor.updateOnPut(mSecond);%0A    mEvictor.updateOnPut(mThird);%0A    mEvictor.updateOnPut(mFourth);%0A    Assert.assertEquals(mFirst, mEvictor.evict());%0A  %7D%0A%0A  @Test%0A  public void evictPutAndGetOrder() %7B%0A    mEvictor.updateOnPut(mFirst);%0A    mEvictor.updateOnPut(mSecond);%0A    mEvictor.updateOnPut(mThird);%0A    mEvictor.updateOnPut(mFourth);%0A    mEvictor.updateOnGet(mFourth);%0A    mEvictor.updateOnGet(mFourth);%0A    mEvictor.updateOnGet(mFourth);%0A    Assert.assertEquals(mFirst, mEvictor.evict());%0A  %7D%0A%0A  @Test%0A  public void evictAfterDelete() %7B%0A    mEvictor.updateOnPut(mFirst);%0A    mEvictor.updateOnPut(mSecond);%0A    mEvictor.updateOnPut(mThird);%0A    mEvictor.updateOnPut(mFourth);%0A    mEvictor.updateOnDelete(mSecond);%0A    Assert.assertEquals(mFirst, mEvictor.evict());%0A    mEvictor.updateOnDelete(mFirst);%0A    Assert.assertEquals(mThird, mEvictor.evict());%0A  %7D%0A%0A  @Test%0A  public void evictEmpty() %7B%0A    Assert.assertNull(mEvictor.evict());%0A  %7D%0A%0A  @Test%0A  public void evictAllGone() %7B%0A    mEvictor.updateOnPut(mFirst);%0A    mEvictor.updateOnPut(mSecond);%0A    mEvictor.updateOnPut(mThird);%0A    mEvictor.updateOnPut(mFourth);%0A    mEvictor.updateOnDelete(mFirst);%0A    mEvictor.updateOnDelete(mSecond);%0A    mEvictor.updateOnDelete(mThird);%0A    mEvictor.updateOnDelete(mFourth);%0A    Assert.assertNull(mEvictor.evict());%0A  %7D%0A%7D%0A

Add unit test for FIFOEvictor