/*
 * 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.cli.fs.command;

import alluxio.AlluxioURI;
import alluxio.Constants;
import alluxio.client.WriteType;
import alluxio.client.file.FileSystemTestUtils;
import alluxio.cli.fs.AbstractAlluxioShellTest;

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

/**
 * Test for unsetTtl command.
 */
public final class UnsetTtlTest extends AbstractAlluxioShellTest {
  @Test
  public void unsetTtl() throws Exception {
    String filePath = "/testFile";
    AlluxioURI uri = new AlluxioURI("/testFile");
    FileSystemTestUtils.createByteFile(mFileSystem, filePath, WriteType.MUST_CACHE, 1);
    Assert.assertEquals(Constants.NO_TTL, mFileSystem.getStatus(uri).getTtl());

    // unsetTTL on a file originally with no TTL will leave the TTL unchanged.
    Assert.assertEquals(0, mFsShell.run("unsetTtl", filePath));
    Assert.assertEquals(Constants.NO_TTL, mFileSystem.getStatus(uri).getTtl());

    long ttl = 1000L;
    Assert.assertEquals(0, mFsShell.run("setTtl", filePath, String.valueOf(ttl)));
    Assert.assertEquals(ttl, mFileSystem.getStatus(uri).getTtl());
    Assert.assertEquals(0, mFsShell.run("unsetTtl", filePath));
    Assert.assertEquals(Constants.NO_TTL, mFileSystem.getStatus(uri).getTtl());
  }
}

@@ -540,16 +540,62 @@
 mmand;%0A%0A
+import static org.junit.Assert.assertEquals;%0A%0A
 import a
@@ -773,33 +773,8 @@
 t;%0A%0A
-import org.junit.Assert;%0A
 impo
@@ -1123,31 +1123,24 @@
 HE, 1);%0A    
-Assert.
 assertEquals
@@ -1276,31 +1276,24 @@
 hanged.%0A    
-Assert.
 assertEquals
@@ -1329,39 +1329,32 @@
 filePath));%0A    
-Assert.
 assertEquals(Con
@@ -1429,31 +1429,24 @@
  1000L;%0A    
-Assert.
 assertEquals
@@ -1501,39 +1501,32 @@
 eOf(ttl)));%0A    
-Assert.
 assertEquals(ttl
@@ -1561,39 +1561,32 @@
 .getTtl());%0A    
-Assert.
 assertEquals(0, 
@@ -1626,23 +1626,16 @@
 ));%0A    
-Assert.
 assertEq

use static import for UnsetTtlTest.java