Simplified and modularized metadata processing
Change-Id: I63e78fd5994126c954263324bcfc2fd9d51e39ea
diff --git a/t/annotation/meta.t b/t/annotation/meta.t
index 713d8fd..f89c934 100644
--- a/t/annotation/meta.t
+++ b/t/annotation/meta.t
@@ -2,6 +2,7 @@
use strict;
use warnings;
use utf8;
+use JSON::XS;
use Test::More;
use Scalar::Util qw/weaken/;
use Data::Dumper;
@@ -22,36 +23,39 @@
is($doc->doc_sigle, 'Corpus_Doc', 'ID-doc');
is($doc->corpus_sigle, 'Corpus', 'ID-corpus');
-is($doc->title, 'Beispiel Text', 'title');
-is($doc->sub_title, 'Beispiel Text Untertitel', 'title');
-is($doc->pub_date, '20010402', 'Publication date');
-is($doc->pub_place, 'Mannheim', 'Publication place');
-is($doc->author, 'Mustermann, Max', 'Author');
+my $meta = $doc->meta;
-is($doc->publisher, 'Artificial articles Inc.', 'Publisher');
-is($doc->editor, 'Monika Mustermann', 'Editor');
-is($doc->text_type, 'Zeitung: Tageszeitung', 'Text Type');
-is($doc->text_type_art, 'Bericht', 'Text Type Art');
-is($doc->text_type_ref, 'Aphorismen', 'Text Type Ref');
-ok(!$doc->text_column, 'Text Column');
-ok(!$doc->text_domain, 'Text Domain');
-is($doc->creation_date, '19990601', 'Creation Date');
-ok(!$doc->license, 'License');
-ok(!$doc->pages, 'Pages');
-ok(!$doc->file_edition_statement, 'File Edition Statement');
-ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement');
-ok(!$doc->reference, 'Reference');
-is($doc->language, 'de', 'Language');
+is($meta->{title}, 'Beispiel Text', 'title');
+is($meta->{sub_title}, 'Beispiel Text Untertitel', 'title');
+is($meta->{pub_date}, '20010402', 'Publication date');
+is($meta->{pub_place}, 'Mannheim', 'Publication place');
+is($meta->{author}, 'Mustermann, Max', 'Author');
-is($doc->doc_title, 'Beispiel Dokument', 'Doc: title');
-ok(!$doc->doc_sub_title, 'Doc: subtitle');
-ok(!$doc->doc_editor, 'Doc: editor');
-ok(!$doc->doc_author, 'Doc: author');
+is($meta->{publisher}, 'Artificial articles Inc.', 'Publisher');
+is($meta->{editor}, 'Monika Mustermann', 'Editor');
+is($meta->{text_type}, 'Zeitung: Tageszeitung', 'Text Type');
+is($meta->{text_type_art}, 'Bericht', 'Text Type Art');
+is($meta->{text_type_ref}, 'Aphorismen', 'Text Type Ref');
+ok(!$meta->{text_column}, 'Text Column');
+ok(!$meta->{text_domain}, 'Text Domain');
+is($meta->{creation_date}, '19990601', 'Creation Date');
+ok(!$meta->{license}, 'License');
+ok(!$meta->{pages}, 'Pages');
+ok(!$meta->{file_edition_statement}, 'File Edition Statement');
+ok(!$meta->{bibl_edition_statement}, 'Bibl Edition Statement');
+ok(!$meta->{reference}, 'Reference');
+is($meta->{language}, 'de', 'Language');
-is($doc->corpus_title, 'Werke von Beispiel', 'Corpus: title');
-ok(!$doc->corpus_sub_title, 'Corpus: subtitle');
-is($doc->corpus_editor, 'Mustermann, Monika', 'Corpus: editor');
-is($doc->corpus_author, 'Mustermann, Max', 'Corpus: author');
+is($meta->{doc_title}, 'Beispiel Dokument', 'Doc: title');
+ok(!$meta->{doc_sub_title}, 'Doc: subtitle');
+ok(!$meta->{doc_editor}, 'Doc: editor');
+ok(!$meta->{doc_author}, 'Doc: author');
+
+is($meta->{corpus_title}, 'Werke von Beispiel', 'Corpus: title');
+ok(!$meta->{corpus_sub_title}, 'Corpus: subtitle');
+is($meta->{corpus_editor}, 'Mustermann, Monika', 'Corpus: editor');
+is($meta->{corpus_author}, 'Mustermann, Max', 'Corpus: author');
+
done_testing;