1
|
package eu.dnetlib.data.collector.plugins.doiresolver;
|
2
|
|
3
|
import eu.dnetlib.data.collector.plugins.HttpConnector;
|
4
|
import org.junit.Assert;
|
5
|
import org.junit.Before;
|
6
|
import org.junit.Ignore;
|
7
|
import org.junit.Test;
|
8
|
|
9
|
@Ignore
|
10
|
public class CrossrefResolverTest {
|
11
|
|
12
|
HttpConnector httpConnector;
|
13
|
CrossrefResolver resolver;
|
14
|
|
15
|
@Before
|
16
|
public void setup(){
|
17
|
httpConnector = new HttpConnector();
|
18
|
resolver = new CrossrefResolver();
|
19
|
resolver.setHttpConnector(httpConnector);
|
20
|
}
|
21
|
|
22
|
@Test
|
23
|
public void testUnexistingDOI(){
|
24
|
String doi = "abcd";
|
25
|
Assert.assertNull(resolver.resolve(doi));
|
26
|
}
|
27
|
|
28
|
@Test
|
29
|
public void testResolveDOI(){
|
30
|
String doi = "10.1016/j.carbpol.2020.115930";
|
31
|
String record = resolver.resolve(doi);
|
32
|
Assert.assertNotNull(record);
|
33
|
System.out.println(record);
|
34
|
}
|
35
|
|
36
|
@Test
|
37
|
public void testIsValid(){
|
38
|
String doi = "10.5281/zenodo.3980491";
|
39
|
Assert.assertTrue(resolver.isValid(doi));
|
40
|
}
|
41
|
|
42
|
@Test
|
43
|
public void testIsNotValid(){
|
44
|
String doi = "https://foo/paper.pdf";
|
45
|
Assert.assertFalse(resolver.isValid(doi));
|
46
|
}
|
47
|
|
48
|
|
49
|
|
50
|
}
|