# Testing Files without Files

DevFeed: [Testing Files without Files](<https://devfeed.tech/articles/testing-files-without-files-29381.md>)

Original publisher: [Read original article](<https://arturdryomov.dev/posts/testing-files-without-files/>)

Author: Artur Dryomov

Published: 2022-02-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [Artur Dryomov](<https://devfeed.tech/sources/artur-dryomov.md>)

Topics: [Testing](<https://devfeed.tech/topics/testing.md>), [Filesystems](<https://devfeed.tech/topics/filesystems.md>), [Java](<https://devfeed.tech/topics/java.md>), [multiplatform](<https://devfeed.tech/topics/multiplatform.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [developer](<https://devfeed.tech/tags/developer.md>), [files](<https://devfeed.tech/tags/files.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [java](<https://devfeed.tech/tags/java.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

This tutorial explains how to test Java file interactions without relying on physical disk files. It compares Java IO with Java NIO and discusses fake file systems such as JimFS, including their benefits and trade-offs. It also introduces Okio as a portable NIO-style option with Kotlin Multiplatform support.

## Source excerpt

File operations become less and less common. As users, we store more and more data in a vendor storage due to its convenience. I remember the contacts file format but cannot locate one on a local machine -- I have Google Contacts instead. As developers, we use datastores -- from S3 to Hive Metastore. Such datastores are scalable, fault tolerant and cheap. However, even if files and file systems are hidden behind various APIs -- it doesn't eliminate them. In this article I'll show how to use Java fake file systems to test file interactions. It's a fun approach but with its own pros and cons.