View Javadoc
1   package org.kuali.ole.pojo.bib;
2   
3   import org.junit.Test;
4   import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.ControlField;
5   import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.DataField;
6   import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.SubField;
7   
8   import java.util.Arrays;
9   
10  import static junit.framework.Assert.assertNotNull;
11  
12  /**
13   * Created by IntelliJ IDEA.
14   * User: ?
15   * Date: 12/15/12
16   * Time: 4:45 PM
17   * To change this template use File | Settings | File Templates.
18   */
19  public class BibliographicNamedFieldsBean_UT {
20  
21      @Test
22      public void testBibliographicNamedFieldsBean() {
23          BibliographicNamedFieldsBean bibliographicNamedFieldsBean = new BibliographicNamedFieldsBean();
24          bibliographicNamedFieldsBean.setAuthor("Sandburg");
25          bibliographicNamedFieldsBean.setTitle("Arithmetic");
26          bibliographicNamedFieldsBean.setDescription("description");
27          bibliographicNamedFieldsBean.setPublisher("sa publication");
28  
29          String author = bibliographicNamedFieldsBean.getAuthor();
30          assertNotNull(author);
31          String title = bibliographicNamedFieldsBean.getTitle();
32          assertNotNull(title);
33          String description = bibliographicNamedFieldsBean.getDescription();
34          assertNotNull(description);
35          String publisher = bibliographicNamedFieldsBean.getPublisher();
36          assertNotNull(publisher);
37  
38  
39      }
40  
41      @Test
42      public void testBibliographicNamedFieldsBean1() {
43          BibliographicNamedFieldsBean bibliographicNamedFieldsBean = new BibliographicNamedFieldsBean();
44  
45          bibliographicNamedFieldsBean.setBibliographicRecord(generateMockBib());
46          assertNotNull(bibliographicNamedFieldsBean);
47      }
48  
49      private BibliographicRecord generateMockBib() {
50          BibliographicRecord bibliographicRecord = new BibliographicRecord();
51          bibliographicRecord.setLeader("MOCK_LEADER");
52  
53          ControlField marcControlField = new ControlField();
54          marcControlField.setTag("001");
55          marcControlField.setValue("1223");
56          ControlField marcControlField1 = new ControlField();
57          marcControlField1.setTag("008");
58          marcControlField1.setValue("12323424");
59          bibliographicRecord.setControlfields(Arrays.asList(marcControlField, marcControlField1));
60  
61          DataField marcDataField = new DataField();
62          marcDataField.setTag("020");
63          marcDataField.setInd1("");
64          marcDataField.setInd1("");
65          SubField marcSubField = new SubField();
66          marcSubField.setCode("a");
67          marcSubField.setValue("CAMBRIDGE INTRODUCTION TO C++ Books & READ**.");
68          SubField marcSubField1 = new SubField();
69          marcSubField1.setCode("c");
70          marcSubField1.setValue("19.99");
71          marcDataField.setSubFields(Arrays.asList(marcSubField, marcSubField1));
72  
73          DataField marcDataField1 = new DataField();
74          marcDataField1.setTag("852");
75          marcDataField1.setInd1("");
76          marcDataField1.setInd1("");
77          SubField marcSubField2 = new SubField();
78          marcSubField2.setCode("a");
79          marcSubField2.setValue("123");
80          SubField marcSubField3 = new SubField();
81          marcSubField3.setCode("b");
82          marcSubField3.setValue("42657");
83          marcDataField1.setSubFields(Arrays.asList(marcSubField2, marcSubField3));
84          bibliographicRecord.setDatafields(Arrays.asList(marcDataField, marcDataField1));
85          return bibliographicRecord;
86      }
87  }