Improve checks regarding annotation boundaries

Resolves #6

Change-Id: I3a41d239ea44923720bb7d557de26f30f285ae67
diff --git a/t/annotation.t b/t/annotation.t
index 1176c98..998e7ea 100644
--- a/t/annotation.t
+++ b/t/annotation.t
@@ -78,6 +78,11 @@
     ->text_is('span > fs > f > fs f:nth-of-type(3)', 'C & A')
 };
 
+subtest 'Wrong annotations' => sub {
+  ok(!KorAP::XML::TEI::Annotations::Annotation->new('p','Error',0));
+  ok(!KorAP::XML::TEI::Annotations::Annotation->new('p',0,'Occurred'));
+  ok(!KorAP::XML::TEI::Annotations::Annotation->new('p',0,5,'Fehler'));
+};
 
 done_testing;
 
diff --git a/t/annotations-collect.t b/t/annotations-collect.t
index 543e693..aa67937 100644
--- a/t/annotations-collect.t
+++ b/t/annotations-collect.t
@@ -44,7 +44,21 @@
 
 my $anno = KorAP::XML::TEI::Annotations::Annotation->new('x4', 20 => 21);
 
-$t->add_annotation($anno);
+ok($anno);
+
+ok($t->add_annotation($anno));
+
+$loy = Test::XML::Loy->new($t->to_string('text',0))
+  ->attr_is('layer', 'docid', 'text')
+  ->attr_is('span#s0', 'to', '8')
+  ->attr_is('span#s1', 'to', '14')
+  ->attr_is('span#s1', 'l', '2')
+  ->attr_is('span#s2', 'to', '20')
+  ->attr_is('span#s3', 'from', '20')
+  ->attr_is('span#s3', 'to', '21')
+;
+
+ok(!$t->add_new_annotation('x1','error','occurred'));
 
 $loy = Test::XML::Loy->new($t->to_string('text',0))
   ->attr_is('layer', 'docid', 'text')