001/** 002 * The contents of this file are subject to the license and copyright 003 * detailed in the LICENSE and NOTICE files at the root of the source 004 * tree. 005 * 006 */ 007package org.fcrepo.migration.foxml; 008 009import java.io.InputStream; 010import java.util.List; 011 012import javax.xml.bind.JAXBException; 013 014import org.junit.Assert; 015import org.junit.Before; 016import org.junit.Test; 017/** 018 * 019 * @author mdurbin 020 * 021 */ 022public class DCTest { 023 024 private DC dcSample1; 025 026 @Before 027 public void setUp() throws JAXBException { 028 final InputStream dcInputStream = this.getClass().getClassLoader().getResourceAsStream("dc-sample1.xml"); 029 dcSample1 = DC.parseDC(dcInputStream); 030 } 031 032 @Test 033 public void testBasicDCParsing() throws JAXBException, IllegalAccessException { 034 Assert.assertEquals("Title 2", dcSample1.title[1]); 035 Assert.assertEquals("Title 1", dcSample1.title[0]); 036 Assert.assertEquals("Creator 2", dcSample1.creator[1]); 037 } 038 039 @Test 040 public void testHelperMethodContract() throws JAXBException, IllegalAccessException { 041 final List<String> uris = dcSample1.getRepresentedElementURIs(); 042 for (final String uri : uris) { 043 Assert.assertFalse(dcSample1.getValuesForURI(uri).isEmpty()); 044 } 045 } 046 047 048 049}