ANY23-348 added test cases

Project: http://git-wip-us.apache.org/repos/asf/any23/repo
Commit: http://git-wip-us.apache.org/repos/asf/any23/commit/244c1585
Tree: http://git-wip-us.apache.org/repos/asf/any23/tree/244c1585
Diff: http://git-wip-us.apache.org/repos/asf/any23/diff/244c1585

Branch: refs/heads/master
Commit: 244c158587e52bac8214490cfbe8f30e6295e0bf
Parents: 61d91b5
Author: Hans <[email protected]>
Authored: Fri May 18 18:49:35 2018 -0500
Committer: Hans <[email protected]>
Committed: Fri May 18 18:49:35 2018 -0500

----------------------------------------------------------------------
 .../microdata/MicrodataExtractorTest.java       |  5 +++
 .../microdata-bad-types-expected.nquads         | 26 ++++++++++++
 .../microdata/microdata-bad-types.html          | 44 ++++++++++++++++++++
 .../src/test/resources/microdata/tel-test.html  | 17 ++++++++
 4 files changed, 92 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/244c1585/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java
 
b/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java
index 86b0a7e..f2e7852 100644
--- 
a/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java
+++ 
b/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java
@@ -192,6 +192,11 @@ public class MicrodataExtractorTest extends 
AbstractExtractorTestCase {
         assertContains(RDFUtils.iri("http://schema.org/telephone";), 
RDFUtils.iri("tel:(909)%20484-2020"));
     }
 
+    @Test
+    public void testBadTypes() throws IOException {
+        extractAndVerifyAgainstNQuads("microdata-bad-types.html", 
"microdata-bad-types-expected.nquads");
+    }
+
     private void extractAndVerifyAgainstNQuads(String actual, String expected)
     throws RepositoryException, RDFHandlerException, IOException, 
RDFParseException {
         assertExtract("/microdata/" + actual);

http://git-wip-us.apache.org/repos/asf/any23/blob/244c1585/test-resources/src/test/resources/microdata/microdata-bad-types-expected.nquads
----------------------------------------------------------------------
diff --git 
a/test-resources/src/test/resources/microdata/microdata-bad-types-expected.nquads
 
b/test-resources/src/test/resources/microdata/microdata-bad-types-expected.nquads
new file mode 100644
index 0000000..1a2414c
--- /dev/null
+++ 
b/test-resources/src/test/resources/microdata/microdata-bad-types-expected.nquads
@@ -0,0 +1,26 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+
+_:node1cdqplnvmx2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://example.org/animals#american%20shorthair> <http://bob.example.com/> .
+_:node1cdqplnvmx2 <http://example.org/animals#img> 
<http://bob.example.com/hedral.jpeg> <http://bob.example.com/> .
+_:node1cdqplnvmx2 <http://example.org/animals#name> "Hedral" 
<http://bob.example.com/> .
+_:node1cdqplnvmx2 <http://example.org/animals#desc> "Hedral is a male american 
domestic shorthair, with a fluffy black fur with white paws and belly." 
<http://bob.example.com/> .
+<http://bob.example.com/> <http://www.w3.org/1999/xhtml/microdata#item> 
_:node1cdqplnvmx2 <http://bob.example.com/> .
+<urn:isbn:0-330-34032-8> <http://schema.org/author> "Peter F. Hamilton\n    " 
<http://bob.example.com/> .
+<urn:isbn:0-330-34032-8> <http://schema.org/title> "The Reality Dysfunction\n  
  " <http://bob.example.com/> .
+<urn:isbn:0-330-34032-8> <http://schema.org/pubdate> 
"1996-01-26"^^<http://www.w3.org/2001/XMLSchema#date> <http://bob.example.com/> 
.
+<http://bob.example.com/> <http://www.w3.org/1999/xhtml/microdata#item> 
<urn:isbn:0-330-34032-8> <http://bob.example.com/> .
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/any23/blob/244c1585/test-resources/src/test/resources/microdata/microdata-bad-types.html
----------------------------------------------------------------------
diff --git 
a/test-resources/src/test/resources/microdata/microdata-bad-types.html 
b/test-resources/src/test/resources/microdata/microdata-bad-types.html
new file mode 100644
index 0000000..4edf349
--- /dev/null
+++ b/test-resources/src/test/resources/microdata/microdata-bad-types.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head></head>
+<body>
+
+<!--  result9 -->
+<section itemscope itemtype=" http://example.org/animals#american shorthair ">
+    <h1 itemprop="name">Hedral</h1>
+    <p itemprop="desc">Hedral is a male american domestic shorthair, with a 
fluffy black fur with white paws and belly.</p>
+    <img itemprop="img" src="hedral.jpeg" alt=""
+         title="Hedral, age 18 months">
+</section>
+
+<!--  result10 -->
+<dl itemscope itemtype=""
+    itemid="urn:isbn:0-330-34032-8">
+    <dt>Title
+    <dd itemprop="title">The Reality Dysfunction
+    <dt>Author
+    <dd itemprop="author">Peter F. Hamilton
+    <dt>Publication date
+    <dd>
+        <time itemprop="pubdate" datetime="1996-01-26">26 January
+            1996</time>
+</dl>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/any23/blob/244c1585/test-resources/src/test/resources/microdata/tel-test.html
----------------------------------------------------------------------
diff --git a/test-resources/src/test/resources/microdata/tel-test.html 
b/test-resources/src/test/resources/microdata/tel-test.html
index f9a6102..5a71a83 100644
--- a/test-resources/src/test/resources/microdata/tel-test.html
+++ b/test-resources/src/test/resources/microdata/tel-test.html
@@ -1,3 +1,20 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- Original page source: http://clubzone.com/ontario-los-angeles/places/ -->
 
 <!DOCTYPE html>
 <html lang="en">

Reply via email to