1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.edo.reviewernote;
17
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertNotNull;
20
21 import java.util.List;
22
23 import org.joda.time.LocalDate;
24 import org.junit.After;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.kuali.kpme.core.IntegrationTest;
28 import org.kuali.kpme.edo.EdoUnitTestBase;
29 import org.kuali.kpme.edo.api.reviewernote.EdoReviewerNote;
30 import org.kuali.kpme.edo.service.EdoServiceLocator;
31
32 @IntegrationTest
33 public class EdoReviewerNoteServiceTest extends EdoUnitTestBase {
34
35 private final String edoReviewerNoteId = "1000";
36 LocalDate asOfDate = new LocalDate(2012,1,1);
37
38 @Before
39 public void setUp() throws Exception {
40 super.setUp();
41
42 }
43
44 @After
45 public void tearDown() throws Exception {
46 super.tearDown();
47 }
48
49 @Test
50 public void testGetReviewerNoteById() throws Exception {
51
52 EdoReviewerNote edoReviewerNote = EdoServiceLocator.getEdoReviewerNoteService().getReviewerNoteById(edoReviewerNoteId);
53 assertEquals("1000", edoReviewerNote.getEdoReviewerNoteId());
54 }
55
56
57 @Test
58 public void testGetReviewerNotesByDossierId() throws Exception {
59
60 List<EdoReviewerNote> edoReviewerNotes = EdoServiceLocator.getEdoReviewerNoteService().getReviewerNotesByDossierId("1000");
61 assertEquals("returned the correct number of results", 4, edoReviewerNotes.size());
62 }
63
64 @Test
65 public void testGetReviewerNotesByUserPrincipalId() throws Exception {
66
67 List<EdoReviewerNote> edoReviewerNotes = EdoServiceLocator.getEdoReviewerNoteService().getReviewerNotesByUserPrincipalId("reviewChair");
68 assertEquals("returned the correct number of results", 2, edoReviewerNotes.size());
69 }
70
71 @Test
72 public void testSaveOrUpdate() throws Exception {
73
74 EdoReviewerNote edoReviewerNote = EdoServiceLocator.getEdoReviewerNoteService().getReviewerNoteById(edoReviewerNoteId);
75 assertEquals("reviewer note1", edoReviewerNote.getNote());
76
77 EdoReviewerNoteBo edoReviewerNoteBo = EdoReviewerNoteBo.from(edoReviewerNote);
78 edoReviewerNoteBo.setNote("Revised Reviewer note1");
79 EdoServiceLocator.getEdoReviewerNoteService().saveOrUpdate(EdoReviewerNoteBo.to(edoReviewerNoteBo));
80
81 edoReviewerNote = EdoServiceLocator.getEdoReviewerNoteService().getReviewerNoteById(edoReviewerNoteId);
82 assertEquals("Revised Reviewer note1", edoReviewerNote.getNote());
83 }
84
85 }