|
1 |
package eu.dnetlib.data.transform.xml;
|
|
2 |
|
|
3 |
import org.junit.After;
|
|
4 |
import org.junit.Before;
|
|
5 |
import org.junit.Test;
|
|
6 |
|
|
7 |
import java.util.List;
|
|
8 |
|
|
9 |
import static org.junit.Assert.assertEquals;
|
|
10 |
|
|
11 |
/**
|
|
12 |
*
|
|
13 |
* Created by miriam on 04/05/2017.
|
|
14 |
*/
|
|
15 |
public class FWDXsltFunctionsTest {
|
|
16 |
private String namesurname ="Gerhard SOMMER";
|
|
17 |
private String noSurname = "Gerhard";
|
|
18 |
private String noName = "SOMMER";
|
|
19 |
private String twoNames = "Gerhard Pippo SOMMER";
|
|
20 |
private String twoSurname = "Gerhard PIPPO SOMMER";
|
|
21 |
private String nonamesurname = "";
|
|
22 |
|
|
23 |
@Before
|
|
24 |
public void before() throws Exception {
|
|
25 |
}
|
|
26 |
|
|
27 |
@After
|
|
28 |
public void after() throws Exception {
|
|
29 |
}
|
|
30 |
|
|
31 |
@Test
|
|
32 |
public void testGetNamesNameNoNameSurname() throws Exception {
|
|
33 |
String ret = FWFXsltFunctions.getName(nonamesurname,true);
|
|
34 |
assertEquals("",ret );
|
|
35 |
}
|
|
36 |
|
|
37 |
@Test
|
|
38 |
public void testGetNamesSurnameNoNameSurname() throws Exception {
|
|
39 |
String ret = FWFXsltFunctions.getName(nonamesurname,false);
|
|
40 |
assertEquals("",ret );
|
|
41 |
}
|
|
42 |
|
|
43 |
@Test
|
|
44 |
public void testGetNamesNameTwoSurname() throws Exception {
|
|
45 |
String ret = FWFXsltFunctions.getName(twoSurname,true);
|
|
46 |
assertEquals("Gerhard",ret );
|
|
47 |
}
|
|
48 |
|
|
49 |
@Test
|
|
50 |
public void testGetNamesSurnameTwoSurname() throws Exception {
|
|
51 |
String ret = FWFXsltFunctions.getName(twoSurname,false);
|
|
52 |
assertEquals("PIPPO SOMMER",ret );
|
|
53 |
}
|
|
54 |
|
|
55 |
@Test
|
|
56 |
public void testGetNamesNameTwoNames() throws Exception {
|
|
57 |
String ret = FWFXsltFunctions.getName(twoNames,true);
|
|
58 |
assertEquals("Gerhard Pippo",ret );
|
|
59 |
}
|
|
60 |
|
|
61 |
@Test
|
|
62 |
public void testGetNamesSurnameTwoNames() throws Exception {
|
|
63 |
String ret = FWFXsltFunctions.getName(twoNames,false);
|
|
64 |
assertEquals("SOMMER",ret );
|
|
65 |
}
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Method: getProvs(String jsonProvList)
|
|
69 |
*/
|
|
70 |
@Test
|
|
71 |
public void testGetNamesName() throws Exception {
|
|
72 |
String ret = FWFXsltFunctions.getName(namesurname,true);
|
|
73 |
assertEquals("Gerhard",ret );
|
|
74 |
}
|
|
75 |
|
|
76 |
@Test
|
|
77 |
public void testGetNamesSurname() throws Exception {
|
|
78 |
String ret = FWFXsltFunctions.getName(namesurname,false);
|
|
79 |
assertEquals("SOMMER",ret );
|
|
80 |
}
|
|
81 |
|
|
82 |
@Test
|
|
83 |
public void testGetNamesNameNoSurname() throws Exception {
|
|
84 |
String ret = FWFXsltFunctions.getName(noSurname,true);
|
|
85 |
assertEquals("Gerhard",ret );
|
|
86 |
}
|
|
87 |
|
|
88 |
@Test
|
|
89 |
public void testGetNamesSurnameNoSurname() throws Exception {
|
|
90 |
String ret = FWFXsltFunctions.getName(noSurname,false);
|
|
91 |
assertEquals("",ret );
|
|
92 |
}
|
|
93 |
|
|
94 |
@Test
|
|
95 |
public void testGetNamesNameNoName() throws Exception {
|
|
96 |
String ret = FWFXsltFunctions.getName(noName,true);
|
|
97 |
assertEquals("",ret );
|
|
98 |
}
|
|
99 |
|
|
100 |
@Test
|
|
101 |
public void testGetNamesSurnameNoName() throws Exception {
|
|
102 |
String ret = FWFXsltFunctions.getName(noName,false);
|
|
103 |
assertEquals("SOMMER",ret );
|
|
104 |
}
|
|
105 |
}
|
Added class for mapping of FWF (for the names of the principal investigators) and test class