 (ns funcatron.sample.clojure.funcs-test
   (:require [clojure.test :refer :all]
-            )
+            [funcatron.sample.clojure.funcs :refer :all])
   (:import (funcatron.intf.impl ContextImpl)
            (java.util.logging Logger)
-           (funcatron.sample.clojure SimpleGet PostOrDelete)
            (com.fasterxml.jackson.databind ObjectMapper)
            (funcatron.intf MetaResponse)))
 

    ))


(deftest Not_POST_DELETE_on_PostOrDelete
  (let [pod (PostOrDelete.)
        result (.apply pod nil (ContextImpl. {"parameters"     {"path" {"cnt" 42}}
                                              "request-method" "get"}
                                             (Logger/getAnonymousLogger)))]
    (is (instance? MetaResponse result))
    (is (= 400 (.getResponseCode ^MetaResponse result)))
    ))

(deftest DELETE_on_PostOrDelete
  (let [pod (PostOrDelete.)
        result (.apply pod nil (ContextImpl. {"parameters"     {"path" {"cnt" 45}}
                                              "request-method" "delete"}
                                             (Logger/getAnonymousLogger)))
        res-json (.writeValueAsString jackson result)]
    (is (contains? result "name"))
    (is (contains? result "age"))


(deftest simple-test
  (testing "Simple"
    (let [result (simple_get {} (ContextImpl. {} (Logger/getAnonymousLogger)))
          res-json (.writeValueAsString jackson result)]
      (is (instance? String res-json))
      (is (>= (.indexOf ^String res-json "bools") 0))
