Package br.com.caelum.bibliography

Source Code of br.com.caelum.bibliography.BibliographyTest

package br.com.caelum.bibliography;

import static org.junit.Assert.assertEquals;

import java.io.File;

import org.junit.Test;

import br.com.caelum.tubaina.bibliography.Bibliography;
import br.com.caelum.tubaina.bibliography.BibliographyEntry;

import com.thoughtworks.xstream.XStream;

public class BibliographyTest {

    @Test
    public void shouldParseABibliographyFromXML() throws Exception {

        XStream xstream = new XStream();
        xstream.addImplicitCollection(Bibliography.class, "entries");
        xstream.alias("bibliography", Bibliography.class);
        xstream.alias("bibliography-entry", BibliographyEntry.class);

        Bibliography bibliography = (Bibliography) xstream.fromXML(new File(
                "src/test/resources/bibliography/bib.xml"));
       
        assertEquals("livro-jose", bibliography.getEntries().get(0).label);
        assertEquals("artigo-jose", bibliography.getEntries().get(1).label);
       
       
       
    }

}
TOP

Related Classes of br.com.caelum.bibliography.BibliographyTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.