@Test public void countTest() throws IOException { TachyonFSTestUtils.createByteFile(mTfs, "/testRoot/testFileA", WriteType.MUST_CACHE, 10); TachyonFSTestUtils.createByteFile( mTfs, "/testRoot/testDir/testFileB", WriteType.MUST_CACHE, 20); TachyonFSTestUtils.createByteFile(mTfs, "/testRoot/testFileB", WriteType.MUST_CACHE, 30); mFsShell.count(new String[] {"count", "/testRoot"}); String expected = ""; String format = "%-25s%-25s%-15s\n"; expected += String.format(format, "File Count", "Folder Count", "Total Bytes"); expected += String.format(format, 3, 2, 60); Assert.assertEquals(expected, mOutput.toString()); }
@Test public void countNotExistTest() throws IOException { int ret = mFsShell.count(new String[] {"count", "/NotExistFile"}); Assert.assertEquals("/NotExistFile does not exist.\n", mOutput.toString()); Assert.assertEquals(-1, ret); }