1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.dnetlib.data.collective.transformation;
|
5
|
|
6
|
import static org.junit.Assert.*;
|
7
|
|
8
|
import org.junit.Before;
|
9
|
import org.junit.Test;
|
10
|
|
11
|
/**
|
12
|
* @author js
|
13
|
*
|
14
|
*/
|
15
|
public class VocabularyTypeEditorTest {
|
16
|
|
17
|
// class under test
|
18
|
private transient VocabularyTypeEditor editor;
|
19
|
private final String json = "{\"map\":{\"Languages\":{\"name\":\"Names of Languages\", \"caseSensitive\":\"false\", \"delimiter\":\"/\"}, \"ReviewLevels\":{\"name\":\"dnet:review_levels\", \"caseSensitive\":\"false\"} }}";
|
20
|
|
21
|
/**
|
22
|
* @throws java.lang.Exception
|
23
|
*/
|
24
|
@Before
|
25
|
public void setUp() throws Exception {
|
26
|
editor = new VocabularyTypeEditor();
|
27
|
}
|
28
|
|
29
|
@Test
|
30
|
public void testGenerate(){
|
31
|
editor.setAsText(json);
|
32
|
assertNotNull(editor.getValue());
|
33
|
assertTrue(editor.getValue() instanceof VocabularyMap);
|
34
|
assertTrue(((VocabularyMap)editor.getValue()).containsKey("Languages"));
|
35
|
assertFalse(((VocabularyMap)editor.getValue()).getMap().get("Languages").isCaseSensitive());
|
36
|
assertTrue(((VocabularyMap)editor.getValue()).containsKey("ReviewLevels"));
|
37
|
|
38
|
}
|
39
|
|
40
|
}
|