-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate file system tests to JUnit 4 #755
Migrate file system tests to JUnit 4 #755
Conversation
The CoreTest class serves as a base class for many tests based on JUnit 3. It provides several file system utilities to its subclasses. These utilities are, however, not inherent to the test class but can be provided as independent utilities. This is especially necessary to break up inheritance hierarchies and foster reuse for JUnit 4/5 migration. This change moves functionalities concerning symlink creation and temp file creation to the FileSystemHelper, which is supposed to provide such functionality.
The FileSystemTest and its subclasses are still based on JUnit 3 due to implementing the CoreTest class. This change does the following: * Migrates FileSystemTest and its subclasses to JUnit 4 * Removes obsolete try/catch blocks by simply making the tests throw the exceptions or asserting the exceptions * Adds missing try-with-resources blocks for streams
de3ccbc
to
2553ae4
Compare
Thanks! |
// The following code creates even a link if | ||
// Files.createSymbolicLink(new File(basedir, linkName).toPath(), new | ||
// File(basedir, linkTarget).toPath()); | ||
// would throw java.nio.file.FileSystemException "missing rights" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HeikoKlare can you tell if this is a common scenario (for tests)?
When looking at the code my fist thought was if Files.createSymbolicLink() can be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HannesWell Unfortunately, I do not know whether this it is (still) a relevant/common scenario. I have only moved/refactored this code from the CoreTest
class without challenging the necessity and way it is implemented.
The
FileSystemTest
and its subclasses are still based on JUnit 3 due to implementing theCoreTest
class.In addition the
CoreTest
class as a base class for many tests based on JUnit 3, provides several file system utilities to its subclasses. These utilities are, however, not inherent to the test class but can be provided as independent utilities. This is especially necessary to break up inheritance hierarchies and foster reuse for JUnit 4/5 migration.This change does the following:
FileSystemHelper
FileSystemTest
and its subclasses to JUnit 4