|
From: <viv...@us...> - 2016-10-19 06:13:00
|
Revision: 192
http://sourceforge.net/p/andspidclient/code/192
Author: vivekpulukuri
Date: 2016-10-19 06:12:58 +0000 (Wed, 19 Oct 2016)
Log Message:
-----------
Unit tests update to check resource type.
Modified Paths:
--------------
trunk/src/test/java/au/csiro/doiclient/utils/TestDoiMetaDataGenerator.java
Modified: trunk/src/test/java/au/csiro/doiclient/utils/TestDoiMetaDataGenerator.java
===================================================================
--- trunk/src/test/java/au/csiro/doiclient/utils/TestDoiMetaDataGenerator.java 2016-10-10 06:54:28 UTC (rev 191)
+++ trunk/src/test/java/au/csiro/doiclient/utils/TestDoiMetaDataGenerator.java 2016-10-19 06:12:58 UTC (rev 192)
@@ -42,6 +42,11 @@
/** Constant giving the xpath of the identifier name **/
private static final String IDENTIFIER_NAME_XPATH = "/xsi:resource/xsi:identifier";
+
+ /**
+ * Constant giving the xPath of the Resource type
+ */
+ private static final String RESOURCETYPE_NAME_XPATH = "/xsi:resource/xsi:resourceType";
/** Constant giving the path to the meta-data template **/
String metadataTemplatePath = "DoiMetadataTemplate.xml";
@@ -108,11 +113,20 @@
xPath.addNamespace("xsi", document.getRootElement().getNamespaceURI());
@SuppressWarnings("rawtypes")
List nodes = xPath.selectNodes(document);
-
assertEquals(6, nodes.size());
assertEquals("creatorName", ((Element) nodes.get(0)).getName());
- assertEquals("Phillips,David", ((Element) nodes.get(0)).getText());
+ assertEquals("Phillips,David", ((Element) nodes.get(0)).getText());
+
+ XPath resourceTypeXPath = XPath.newInstance(RESOURCETYPE_NAME_XPATH);
+ resourceTypeXPath.addNamespace("xsi", document.getRootElement().getNamespaceURI());
+ @SuppressWarnings("rawtypes")
+ List rnodes = resourceTypeXPath.selectNodes(document);
+
+ assertEquals(1, rnodes.size());
+
+ assertEquals("resourceType", ((Element) rnodes.get(0)).getName());
+ assertEquals("Reports", ((Element) rnodes.get(0)).getText());
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|