 
   (testing "context works correctly in injected functions"
     (let [service1 (service Service1
-                            []
-                            (init [this context] (assoc context :foo :bar))
-                            (service1-fn [this] ((svcs/service-context this) :foo)))
+                     []
+                     (init [this context] (assoc context :foo :bar))
+                     (service1-fn [this] ((svcs/service-context this) :foo)))
           service2 (service Service2
-                            [[:Service1 service1-fn]]
-                            (service2-fn [this] (service1-fn)))
+                     [[:Service1 service1-fn]]
+                     (service2-fn [this] (service1-fn)))
           app (bootstrap-services-with-empty-config [service1 service2])
           s2  (app/get-service app :Service2)]
       (is (= :bar (service2-fn s2)))))
 
   (testing "context works correctly in service functions called by other functions in same service"
     (let [service4 (service Service4
-                            []
-                            (init [this context] (assoc context :foo :bar))
-                            (service4-fn1 [this] ((svcs/service-context this) :foo))
-                            (service4-fn2 [this] (service4-fn1 this)))
+                     []
+                     (init [this context] (assoc context :foo :bar))
+                     (service4-fn1 [this] ((svcs/service-context this) :foo))
+                     (service4-fn2 [this] (service4-fn1 this)))
           app (bootstrap-services-with-empty-config [service4])
           s4  (app/get-service app :Service4)]
       (is (= :bar (service4-fn2 s4)))))

(deftest dependencies-test
  (testing "services should be able to call functions in dependency list"
    (let [service1 (service Service1
                            []
                            (service1-fn [this] "FOO!"))
          service2 (service Service2
                            [[:Service1 service1-fn]]
                            (service2-fn [this] (str "HELLO " (service1-fn))))
          app (bootstrap-services-with-empty-config [service1 service2])
          s2  (app/get-service app :Service2)]
      (is (= "HELLO FOO!" (service2-fn s2)))))

  (testing "services should be able to retrieve instances of services that they depend on"
    (let [service1 (service Service1
                            []
                            (service1-fn [this] "FOO!"))
          service2 (service Service2
                            [[:Service1 service1-fn]]
                            (init [this context]
                                  (let [s1 (svcs/get-service this :Service1)]
                                    (assoc context :s1 s1)))
                            (service2-fn [this] ((svcs/service-context this) :s1)))
          app               (bootstrap-services-with-empty-config [service1 service2])
          s2                (app/get-service app :Service2)
          s1                (service2-fn s2)]

  (testing "service-id should be able to be called from any lifecycle phase"
    (let [test-context (atom {})
          service1 (service Service1
                     []
                     (init [this context]
                           (swap! test-context assoc :init-service-id (svcs/service-id this))
                           context)
                     (start [this context]
                            (swap! test-context assoc :start-service-id (svcs/service-id this))
                            context)
                     (stop [this context]
                           (swap! test-context assoc :stop-service-id (svcs/service-id this))
                           context)
                     (service1-fn [this] nil))]
      (with-app-with-empty-config app [service1]
        ;; no-op; we just want the app to start up and shut down
        )
