/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.underfs;

import alluxio.util.CommonUtils;

import org.junit.Assert;
import org.junit.Test;

import java.util.Random;

/**
 * Tests for the {@link UfsFileStatus} class.
 */
public final class UfsFileStatusTest {
  /**
   * Tests getting and setting fields.
   */
  @Test
  public void fields() {
    Random random = new Random();
    String contentHash = CommonUtils.randomAlphaNumString(10);
    long contentLength = random.nextLong();
    long lastModifiedTimeMs = random.nextLong();
    short mode = 077;
    UfsFileStatus status =
        new UfsFileStatus("name", contentHash, contentLength, lastModifiedTimeMs, "owner", "group",
            mode);

    Assert.assertEquals("name", status.getName());
    Assert.assertEquals(contentHash, status.getContentHash());
    Assert.assertEquals(contentLength, status.getContentLength());
    Assert.assertEquals(false, status.isDirectory());
    Assert.assertEquals(true, status.isFile());
    Assert.assertEquals(lastModifiedTimeMs, (long) status.getLastModifiedTime());
    Assert.assertEquals("owner", status.getOwner());
    Assert.assertEquals("group", status.getGroup());
    Assert.assertEquals(mode, status.getMode());
  }

  /**
   * Tests if the copy constructor works.
   */
  @Test
  public void copy() {
    Random random = new Random();
    String contentHash = CommonUtils.randomAlphaNumString(10);
    long contentLength = random.nextLong();
    long lastModifiedTimeMs = random.nextLong();
    short mode = 077;
    UfsFileStatus statusToCopy =
        new UfsFileStatus("name", contentHash, contentLength, lastModifiedTimeMs, "owner", "group",
            mode);
    UfsFileStatus status = new UfsFileStatus(statusToCopy);
    Assert.assertEquals(statusToCopy, status);
  }
}

@@ -529,24 +529,70 @@
 o.underfs;%0A%0A
+import static org.junit.Assert.assertEquals;%0A%0A
 import allux
@@ -617,33 +617,8 @@
 s;%0A%0A
-import org.junit.Assert;%0A
 impo
@@ -1199,31 +1199,24 @@
 mode);%0A%0A    
-Assert.
 assertEquals
@@ -1239,39 +1239,32 @@
 getName());%0A    
-Assert.
 assertEquals(con
@@ -1295,39 +1295,32 @@
 entHash());%0A    
-Assert.
 assertEquals(con
@@ -1355,39 +1355,32 @@
 tLength());%0A    
-Assert.
 assertEquals(fal
@@ -1402,39 +1402,32 @@
 rectory());%0A    
-Assert.
 assertEquals(tru
@@ -1443,39 +1443,32 @@
 .isFile());%0A    
-Assert.
 assertEquals(las
@@ -1518,39 +1518,32 @@
 iedTime());%0A    
-Assert.
 assertEquals(%22ow
@@ -1564,39 +1564,32 @@
 etOwner());%0A    
-Assert.
 assertEquals(%22gr
@@ -1614,31 +1614,24 @@
 oup());%0A    
-Assert.
 assertEquals
@@ -2174,23 +2174,16 @@
 y);%0A    
-Assert.
 assertEq

Use static imports for standard test utilities