       (testing (str name " should break")
         (is (not (nil? processed)))
         (is (:invalid? processed))
-        (is (= 0 @(-> processor :persistence :appends-n)))
+        (is (= 0 (-> processor :persistence :events-n deref)))
         (is (= 0 @(-> processor :projectors first :features-n))) ; no new features
         (is (= 0 @(-> processor :projectors first :changes-n))))
       )))

    (swap! changes-n inc))
  (close [this] (assoc this :closed true)))

(defn create-persistence [] (->MockedPersistence (atom 0) (atom 0) false nil nil))

(defn create-projectors [n]
  (repeatedly n #(->MockedProjector (atom 0) (atom 0))))

            [pdok.featured.projectors :as proj]
            [clojure.test :refer :all]))

(defrecord MockedPersistence [streams streams-n state events-n]
  pers/ProcessorPersistence
  (init [this] (assoc this :initialized true))
  (stream-exists? [this dataset collection id] (get @streams [dataset collection id]))
  (create-stream [this dataset collection id]
    (pers/create-stream this dataset collection id nil nil))
  (create-stream [this dataset collection id parent-collection parent-id]
    (swap! streams assoc [dataset collection id] 1)
    (swap! streams-n inc))
  (append-to-stream [this version action dataset collection id validity geometry attributes]
    (swap! state assoc [dataset collection id] [action validity])
    (swap! events-n inc))
  (current-validity [_ dataset collection id]
    (second (get @state [dataset collection id] nil)))
  (last-action [this dataset collection id]
    (first (get @state [dataset collection id] nil)))
  (close [this] (assoc this :closed true)))

(defrecord MockedProjector [features-n changes-n]
