Functional Programming, Scala, Unit Testing, Zio, Zio Effects.
console and returns it as a result: import zio._ import zio.console._ object Program { val readLine: ZIO[Console, IOException, String] = ZIO.effect(scala.io.StdIn.readLine()) val program: ZIO[Console, IOException, String] = for { line <- readLine } yield line } You can write a unit test for this