   (let [rtype (.getGenericReturnType method)]
     (condp = rtype
         Integer/TYPE (is (= "sodium_init" (.getName method)))
-        Long/TYPE (is (= #{size_t} (annotation-set method)))
+        Long/TYPE (is (= #{size_t}
+                         (clean-annotations (.getAnnotations method))))
         (is (= String rtype)))))


(declare check-method check-const-method)

(deftest interface-test
  (doseq [method (.getMethods Sodium)]
    (if-let [params (seq (.getParameters ^Method method))]
      (check-method method params)
      (check-const-method method))))

(defn annotation-set
  [param]
  (->> (.getAnnotations ^AnnotatedElement param)
       (map #(.annotationType ^Annotation %))
       set))

(defn check-method
  "Check a method binding a non-const fn."

           Void/TYPE
           Integer/TYPE)
         (.getGenericReturnType method)))
  (doseq [{:keys [type annotations]} params]
    (is (= (condp (fn [x y] (x y)) type
             #{ByteArray ByteBuffer} #{Pinned}
             #{Long/TYPE}  #{LongLong}
             #{LongLongByReference} #{})
           annotations))))

(defn check-const-method
  "Check a method binding a const fn."
