public virtual void TestScanDirectory() { Path p = new Path("any"); FileContext fc = Org.Mockito.Mockito.Mock <FileContext>(); Org.Mockito.Mockito.When(fc.MakeQualified(p)).ThenReturn(p); Org.Mockito.Mockito.When(fc.ListStatus(p)).ThenThrow(new FileNotFoundException()); IList <FileStatus> lfs = HistoryFileManager.ScanDirectory(p, fc, null); //primarily, succcess is that an exception was not thrown. Also nice to //check this NUnit.Framework.Assert.IsNotNull(lfs); }