Alan, as has been pointed out already, the error message means that some type of checked exception could be thrown by the code in the method. The solution is to either surround the code with a try-catch block that handles the checked exception or declare the exception in a throws clause.
The suggestions given so far have been to add an appropriate catch block to handle the checked exceptions. However, it looks like the code you posted is part of a
JUnit TestCase. In this case,
you should probably just declare your testListDirectory method to throw an Exception. The JUnit idiom for catch blocks is to add them if you are testing whether the class under test actually throws the exception. For example, assuming the class under test is the FileChecker class:
If you're only testing for the missCleo.listDirectory() functionality and not expecting any exceptions, then just let all Exceptions bubble up to the JUnit framework. In a JUnit test, a
failure means the test ran successfully but didn't pass. An
error, which is what any Exceptions you let bubble up to the framework will cause, means something else. An error means there is something wrong with your test setup/environment. An error doesn't mean your test failed, it means the test didn't run successfully and that the result of the test is inconclusive.