1
|
package eu.dnetlib.msro.openaireplus.workflows.nodes.hostedby;
|
2
|
|
3
|
import java.io.IOException;
|
4
|
|
5
|
import junit.framework.Assert;
|
6
|
import org.dom4j.Document;
|
7
|
import org.dom4j.DocumentException;
|
8
|
import org.dom4j.io.SAXReader;
|
9
|
import org.junit.Test;
|
10
|
import org.springframework.core.io.ClassPathResource;
|
11
|
import org.springframework.core.io.Resource;
|
12
|
|
13
|
public class PatchHostedByTest {
|
14
|
|
15
|
private Resource xmlInput = new ClassPathResource("/eu/dnetlib/msro/openaireplus/workflows/nodes/hostedby/input.xml");
|
16
|
|
17
|
private final SAXReader reader = new SAXReader();
|
18
|
|
19
|
private final String xpath = "substring-after(//*[local-name()='supplementTo']/*[local-name()='source']/@id,'.')";
|
20
|
|
21
|
@Test
|
22
|
public void testEvaluate() throws DocumentException, IOException {
|
23
|
|
24
|
final Document doc = reader.read(xmlInput.getInputStream());
|
25
|
|
26
|
for (Object o : doc.selectNodes(this.xpath)) {
|
27
|
Assert.assertEquals("journal10808", o);
|
28
|
}
|
29
|
|
30
|
}
|
31
|
}
|