001package org.kuali.ole.pojo.bib;
002
003import org.junit.Test;
004import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.ControlField;
005import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.DataField;
006import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.SubField;
007
008import java.util.Arrays;
009
010import static junit.framework.Assert.assertNotNull;
011
012/**
013 * Created by IntelliJ IDEA.
014 * User: ?
015 * Date: 12/15/12
016 * Time: 4:45 PM
017 * To change this template use File | Settings | File Templates.
018 */
019public class BibliographicNamedFieldsBean_UT {
020
021    @Test
022    public void testBibliographicNamedFieldsBean() {
023        BibliographicNamedFieldsBean bibliographicNamedFieldsBean = new BibliographicNamedFieldsBean();
024        bibliographicNamedFieldsBean.setAuthor("Sandburg");
025        bibliographicNamedFieldsBean.setTitle("Arithmetic");
026        bibliographicNamedFieldsBean.setDescription("description");
027        bibliographicNamedFieldsBean.setPublisher("sa publication");
028
029        String author = bibliographicNamedFieldsBean.getAuthor();
030        assertNotNull(author);
031        String title = bibliographicNamedFieldsBean.getTitle();
032        assertNotNull(title);
033        String description = bibliographicNamedFieldsBean.getDescription();
034        assertNotNull(description);
035        String publisher = bibliographicNamedFieldsBean.getPublisher();
036        assertNotNull(publisher);
037
038
039    }
040
041    @Test
042    public void testBibliographicNamedFieldsBean1() {
043        BibliographicNamedFieldsBean bibliographicNamedFieldsBean = new BibliographicNamedFieldsBean();
044
045        bibliographicNamedFieldsBean.setBibliographicRecord(generateMockBib());
046        assertNotNull(bibliographicNamedFieldsBean);
047    }
048
049    private BibliographicRecord generateMockBib() {
050        BibliographicRecord bibliographicRecord = new BibliographicRecord();
051        bibliographicRecord.setLeader("MOCK_LEADER");
052
053        ControlField marcControlField = new ControlField();
054        marcControlField.setTag("001");
055        marcControlField.setValue("1223");
056        ControlField marcControlField1 = new ControlField();
057        marcControlField1.setTag("008");
058        marcControlField1.setValue("12323424");
059        bibliographicRecord.setControlfields(Arrays.asList(marcControlField, marcControlField1));
060
061        DataField marcDataField = new DataField();
062        marcDataField.setTag("020");
063        marcDataField.setInd1("");
064        marcDataField.setInd1("");
065        SubField marcSubField = new SubField();
066        marcSubField.setCode("a");
067        marcSubField.setValue("CAMBRIDGE INTRODUCTION TO C++ Books & READ**.");
068        SubField marcSubField1 = new SubField();
069        marcSubField1.setCode("c");
070        marcSubField1.setValue("19.99");
071        marcDataField.setSubFields(Arrays.asList(marcSubField, marcSubField1));
072
073        DataField marcDataField1 = new DataField();
074        marcDataField1.setTag("852");
075        marcDataField1.setInd1("");
076        marcDataField1.setInd1("");
077        SubField marcSubField2 = new SubField();
078        marcSubField2.setCode("a");
079        marcSubField2.setValue("123");
080        SubField marcSubField3 = new SubField();
081        marcSubField3.setCode("b");
082        marcSubField3.setValue("42657");
083        marcDataField1.setSubFields(Arrays.asList(marcSubField2, marcSubField3));
084        bibliographicRecord.setDatafields(Arrays.asList(marcDataField, marcDataField1));
085        return bibliographicRecord;
086    }
087}