Working and unit testing with temporary files in Java

This page summarizes the projects mentioned and recommended in the original post on /r/java

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • junit-io

    Support for repeatable unit tests involving interactions with the file system.

  • More often that not, if they hit the file system, my tests involve creating directories also. I wonder how others deal with this.. This is my boilerplate code https://github.com/gnahraf/junit-io

  • Jimfs

    An in-memory file system for Java 7+

  • I use Google's JIMFS "Just In Memory Filesystem" https://github.com/google/jimfs in my unit tests and have been very happy. No need to clean something up that disappears as soon as the test is over. Let's you create unix or windows style filesystems and I've used it to test a disk space healthcheck because you can set a limit to the size of the filesystem it creates. Very flexible and easy to use.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts