   (.stop tailer)
   (a/close! channel))
 
-(fact (let [lines     ["a" "b" "c" "d" "e"]
-            file      (File. "test/_work-dir/plop.log")
-            t-and-c   (tailer-and-channel file 100)
-            result-ch (a/thread (doall (tailer-and-channel->seq t-and-c)))]
-        (Thread/sleep 1000)
-        (spit file "")
-        (spit file (str (str/join "\n" lines)
-                        "\n"))
-        (Thread/sleep 1000)
-        (println "Stopping")
+(defn delete-and-spit-with-waits [f content sleep-ms]
+  (io/delete-file f)
+  (Thread/sleep sleep-ms)
+  (spit f content)
+  (Thread/sleep sleep-ms))
+
+(fact (let [delay-ms        100
+            sleep-ms        500 ; (+ delay-ms 100)
+            lines           ["a" "b" "c" "d" "e"]
+            file-content    (str (str/join "\n" lines)
+                                 "\n")
+            file            (File. "test/_work-dir/plop.log")
+            t-and-c         (tailer-and-channel file delay-ms)
+            result-ch       (a/thread (doall (tailer-and-channel->seq t-and-c)))
+            n-rotations     3
+            expected-result (apply concat (repeat n-rotations lines))]
+        (Thread/sleep sleep-ms)
+        (dotimes [_ n-rotations]
+          (delete-and-spit-with-waits file file-content sleep-ms))
         (stop-tailer-and-channel t-and-c)
         (a/<!! result-ch)
-        => lines))
+        => expected-result))
 
 ;; TODO
 ;; Check that bug.

(ns com.nomistech.clojure-the-language.c-920-io.tailing
  (:require [clojure.core.async :as a]
            [clojure.string :as str]
            [midje.sweet :refer :all])
  (:import (java.io File)

  (reify TailerListener
    (init [this tailer] ())
    (fileNotFound [this]
      ;; (println "File not found")
      )
    (fileRotated [this]
      ;; (println "Rotation detected")
      )
    (^void handle [this ^String line]
     (a/>!! c line))
    (^void handle [this ^Exception i]
