JUnit @Rule TemporaryFolder will delete the folder in case there is an Exception during execution of the test.
For my testing purposes I created my custom @Rule MyTemporaryFolder which is essentially the same except for when the exception happens it will save the temporary folder so the internals of the folder can be examined (basically any test output).
So now I have to write unit tests for my custom @Rule class. How can I do it? How can I simulate test starting and finishing inside of another test so I can check if my temporary folder was deleted properly (or is still there)?