 
 
           (testing "granule collection-refs missing field"
-            (let [collection (dc/collection {:entry-title "correct"
-                                             :short-name "S1"
-                                             :version-id "V1"})
-                  coll-concept (d/item->concept collection)
-                  granule (assoc (dg/granule collection)
+            (let [collection (data-umm-c/collection {:EntryTitle "correct"
+                                             :ShortName "S1"
+                                             :Version "V1"})
+                  coll-concept (d/umm-c-collection->concept collection)
+                  granule (assoc (dg/granule-with-umm-spec-collection collection (:concept-id collection)) 
                                  :collection-ref
                                  (umm-g/map->CollectionRef {:entry-title nil
                                                             :short-name nil

                422
                [{:path ["CollectionRef"],
                  :errors ["Collection Reference Version Id [V2] does not match the Version Id of the parent collection [V1]"]}]
                (d/item->concept (assoc (dg/granule collection)
                                        :collection-ref
                                        (umm-g/map->CollectionRef {:short-name "S1"
                                                                   :version-id "V2"})))
                coll-concept)))

          (testing "granule collection-refs with all entry-title, short-name and version-id"
            (let [collection-ref-attrs {:entry-title "correct"
                                        :short-name "S1"
                                        :version-id "V1"}
                  collection (dc/collection collection-ref-attrs)
                  coll-concept (d/item->concept collection :iso-smap)]
              (testing "valid SMAP ISO granule"
                (let [granule (assoc (dg/granule collection)
                                     :collection-ref
                                     (umm-g/map->CollectionRef collection-ref-attrs))]
                  (assert-validation-success (d/item->concept granule :iso-smap)
                                             coll-concept)))
              (testing "invalid SMAP ISO granule"
                (are [attrs errors]
                     (let [granule (assoc (dg/granule collection)
                                          :collection-ref
                                          (umm-g/map->CollectionRef (merge collection-ref-attrs attrs)))]
                       (assert-validation-errors

                 coll-concept)))

    (testing "with collection as additional parameter"
      (let [collection (data-umm-c/collection {})
            coll-concept (d/umm-c-collection->concept collection :echo10)]
        (testing "success"
          (let [concept (d/item->concept (dg/granule-with-umm-spec-collection collection (:concept-id collection)))]
            (assert-validation-success concept coll-concept)))
        (testing "collection in different format than granule"
          (let [concept (d/item->concept (dg/granule-with-umm-spec-collection collection (:concept-id collection)))]
            (assert-validation-success concept (d/umm-c-collection->concept collection :iso19115))
            (assert-validation-success concept (d/umm-c-collection->concept collection :dif))))

        (testing "invalid collection xml"
          (assert-validation-errors
            400
            [(msg/invalid-parent-collection-for-validation
               "Line 1 - cvc-elt.1: Cannot find the declaration of element 'Granule'.")]
            (d/item->concept (dg/granule-with-umm-spec-collection collection (:concept-id collection)))
            (assoc coll-concept :metadata invalid-granule-xml)))

        (testing "invalid granule xml"
          (assert-validation-errors
            400
            expected-errors
            (-> (dg/granule-with-umm-spec-collection collection (:concept-id collection)) 
                d/item->concept
                (assoc :metadata invalid-granule-xml))
            coll-concept))
