From a68fa8fd84190c71bdde9f8cea1de7ab3408469c Mon Sep 17 00:00:00 2001
From: Jens Steidl <Jens.Steidl@slub-dresden.de>
Date: Fri, 9 Apr 2021 14:14:21 +0200
Subject: [PATCH] - added test cases

---
 t/slubsipbuilderbagit.t | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/t/slubsipbuilderbagit.t b/t/slubsipbuilderbagit.t
index 9f38643..4ca8fe7 100644
--- a/t/slubsipbuilderbagit.t
+++ b/t/slubsipbuilderbagit.t
@@ -195,6 +195,18 @@ throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_marc21_text_node(undef, { tag => "245
 throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_marc21_text_node($marc21, ""   ); } qr/not a mapping hash/, "get_marc21_text_node(), invalid";
 throws_ok{ SLUB::LZA::SIPBuilderBagIt::get_marc21_text_node($marc21, undef); } qr/not a mapping hash/, "get_marc21_text_node(), invalid";
 #
+my $marc_xml_unpatched = << "MARCXML";
+<?xml version="1.0"?>
+<record xmlns="http://www.loc.gov/MARC21/slim">
+</record>
+MARCXML
+my $marc_doc = XML::LibXML->load_xml(string=>$marc_xml_unpatched);
+ok( SLUB::LZA::SIPBuilderBagIt::add_marc21_schema_location($marc_doc), "add_marc21_schema_location(), valid");
+like( $marc_doc->serialize(), qr/xsi:schemaLocation/, "add_marc21_schema_location(), valid");
+throws_ok{ SLUB::LZA::SIPBuilderBagIt::add_marc21_schema_location(0); } qr/marc xml document required/, "add_marc21_schema_location(), invalid";
+throws_ok{ SLUB::LZA::SIPBuilderBagIt::add_marc21_schema_location(""); } qr/marc xml document required/, "add_marc21_schema_location(), invalid";
+throws_ok{ SLUB::LZA::SIPBuilderBagIt::add_marc21_schema_location(undef); } qr/marc xml document required/, "add_marc21_schema_location(), invalid";
+#
 my @baginfo_got = @addBagInfo;
 my @baginfo_expected = @addBagInfo;
 push @baginfo_expected, (
-- 
GitLab