Project

General

Profile

Download (1.73 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.io.jaxb;
10

    
11
import static org.junit.Assert.assertNotNull;
12

    
13
import java.io.InputStreamReader;
14
import eu.etaxonomy.cdm.common.URI;
15

    
16
import org.junit.Test;
17

    
18
import eu.etaxonomy.cdm.model.media.Media;
19

    
20
public class LanguageStringTest {
21
		
22
	    private String resource = "/eu/etaxonomy/cdm/io/jaxb/LanguageStringTest.xml";
23
	    
24
	    @Test
25
	    public void testUnmarshalLanguageString() throws Exception {
26
	        CdmDocumentBuilder cdmDocumentBuilder = new CdmDocumentBuilder();
27
	        URI uri = new URI(URIEncoder.encode(this.getClass().getResource(resource).toString()));
28
	        DataSet dataSet = cdmDocumentBuilder.unmarshal(DataSet.class, new InputStreamReader(this.getClass().getResourceAsStream(resource)),uri.toString());
29
			
30
			Media media = (Media)dataSet.getMedia().get(0);	
31
			assertNotNull("Media must not be null",media);
32
			/* TODO: Does not work because the term loading does not work in test cases...
33
			assertNotNull("Media.title must not be null", media.getTitle(Language.ENGLISH()));
34
			assertFalse("Media.title must contain LanguageString elements",media.getAllTitles().isEmpty());
35
			LanguageString languageString = media.getAllTitles().values().iterator().next();
36
			assertNotNull("LanguageString.text must not be null", languageString.getText());
37
			assertEquals("LanguageString.text must contain the expected value","<i xmlns=\"http://www.w3.org/1999/xhtml\">English</i> Title",languageString.getText());
38
	   		*/
39
	    }
40
}
(7-7/17)