Utilities
Utility classes for common testing tasks
Verifyica provides utility classes for common testing scenarios.
CleanupExecutor
Manages cleanup tasks in reverse order (LIFO).
CleanupExecutor cleanupExecutor = new CleanupExecutor();
cleanupExecutor.add(() -> resource1.close());
cleanupExecutor.add(() -> resource2.close());
// Executes resource2.close() then resource1.close()
cleanupExecutor.execute();
See Advanced → Cleanup Executor for detailed usage.
TemporaryDirectory
Creates temporary directories for tests.
TemporaryDirectory tempDir = TemporaryDirectory.create();
Path path = tempDir.getPath();
// Use directory...
tempDir.close(); // Deletes directory and contents
RandomUtil
Utilities for random values in tests.
int randomInt = RandomUtil.nextInt(100);
String randomString = RandomUtil.nextString(10);
See Also
- Advanced → Cleanup Executor - Detailed CleanupExecutor guide
- Core Concepts - Core testing concepts
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.