 (deftest ok-new-feature
   (let [processor (create-processor)
         processed (first (consume processor valid-new-feature))]
-    (is (not (nil? processed)))
+    (is (= false (nil? processed)))
     (is (not (:invalid? processed)))
-    (is (= 1 @(-> processor :persistence :streams-n)))
-    (is (= 1 @(-> processor :persistence :appends-n)))
+    (is (= 1 (-> processor :persistence :streams-n deref)))
+    (is (= 1 (-> processor :persistence :events-n deref)))
     (is (= 1 @(-> processor :projectors first :features-n)))))
 
 (def make-broken-new-transformations

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

(defrecord MockedPersistence [streams-n appends-n exists? current-validity last-action]
  pers/ProcessorPersistence
  (init [this] (assoc this :initialized true))
  (stream-exists? [this dataset collection id] exists?)
  (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-n inc))
  (append-to-stream [this version action dataset collection id validity geometry attributes]
    (swap! appends-n inc))
  (current-validity [_ dataset collection id]
    current-validity)
  (last-action [this dataset collection id]
    last-action)
  (close [this] (assoc this :closed true)))

(defrecord MockedProjector [features-n changes-n]

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

(defn create-persistence [] (->MockedPersistence (atom {}) (atom 0) (atom {}) (atom 0)))

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