View Javadoc
1   package org.kuali.ole.deliver.service;
2   
3   import org.junit.Before;
4   import org.junit.Test;
5   import org.kuali.ole.OLEConstants;
6   import org.kuali.ole.deliver.batch.OleNoticeBo;
7   import org.kuali.ole.deliver.bo.OleLoanDocument;
8   import org.kuali.ole.deliver.bo.OlePatronDocument;
9   import org.kuali.ole.deliver.notice.bo.OleNoticeContentConfigurationBo;
10  import org.kuali.ole.deliver.notice.bo.OleNoticeFieldLabelMapping;
11  import org.kuali.ole.describe.bo.OleLocation;
12  import org.kuali.rice.kim.impl.identity.entity.EntityBo;
13  import org.kuali.rice.kim.impl.identity.name.EntityNameBo;
14  import org.kuali.rice.kim.impl.identity.type.EntityTypeContactInfoBo;
15  import org.kuali.rice.krad.service.BusinessObjectService;
16  import org.mockito.Mock;
17  import org.mockito.Mockito;
18  import org.mockito.MockitoAnnotations;
19  
20  import java.math.BigDecimal;
21  import java.sql.Timestamp;
22  import java.text.SimpleDateFormat;
23  import java.util.*;
24  
25  import static junit.framework.TestCase.assertNotNull;
26  
27  /**
28   * Created by pvsubrah on 4/6/15.
29   */
30  public class NoticeMailContentFormatterTest {
31  
32      @Mock
33      private ParameterValueResolver parameterValueResolver;
34  
35      @Mock
36      private OleDeliverRequestDocumentHelperServiceImpl oleDeliverRequestDocumentHelperService;
37  
38      @Mock
39      private BusinessObjectService businessObjectService;
40  
41      @Mock
42      private OlePatronDocument mockOlePatronDocument;
43  
44      @Mock
45      private OleLoanDocument mockOleLoanDocument;
46  
47      @Mock
48      private OleLoanDocument mockOleLoanDocument1;
49  
50      @Mock
51      private OleLocation mockOleLocation;
52  
53  
54      @Before
55      public void setUp() throws Exception {
56          MockitoAnnotations.initMocks(this);
57      }
58  
59  
60      @Test
61      public void testGenerateMailContent() throws Exception {
62          NoticeMailContentFormatter noticeMailContentFormatter = new MockNoticeMailContentFormatter();
63  
64          Mockito.when(parameterValueResolver.getParameter(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()
65          )).thenReturn("TITLE");
66          Mockito.when(parameterValueResolver.getParameter(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
67                  .thenReturn
68                          ("CONTENT");
69          noticeMailContentFormatter.setParameterValueResolver(parameterValueResolver);
70          noticeMailContentFormatter.setOleDeliverRequestDocumentHelperService(oleDeliverRequestDocumentHelperService);
71          noticeMailContentFormatter.setBusinessObjectService(businessObjectService);
72  
73  
74          OleLoanDocument oleLoanDocument = new OleLoanDocument();
75  
76          OlePatronDocument olePatron = new OlePatronDocument();
77          olePatron.setBarcode("123125");
78          EntityBo entity = new EntityBo();
79          ArrayList<EntityNameBo> entityNameBos = new ArrayList<EntityNameBo>();
80          EntityNameBo entityNameBo = new EntityNameBo();
81          entityNameBo.setFirstName("FirtName");
82          entityNameBos.add(entityNameBo);
83          entity.setNames(entityNameBos);
84          ArrayList<EntityTypeContactInfoBo> entityTypeContactInfos = new ArrayList<EntityTypeContactInfoBo>();
85          entityTypeContactInfos.add(new EntityTypeContactInfoBo());
86          entity.setEntityTypeContactInfos(entityTypeContactInfos);
87          olePatron.setEntity(entity);
88  
89          oleLoanDocument.setOlePatron(olePatron);
90  
91          HashMap<String, String> fieldLabelMap = new HashMap<>();
92          String mailContent = noticeMailContentFormatter.generateMailContentForPatron(Collections.singletonList(oleLoanDocument), new OleNoticeContentConfigurationBo());
93          System.out.println(mailContent);
94  
95      }
96  
97  
98      @Test
99      public void generateNoticeHTML() throws Exception {
100         NoticeMailContentFormatter noticeMailContentFormatter =  new OverdueNoticeEmailContentFormatter();
101         OleNoticeBo oleNoticeBo = new OleNoticeBo();
102         oleNoticeBo.setPatronName("John Doe");
103         oleNoticeBo.setPatronAddress("123, High Street, MA - 201231");
104         oleNoticeBo.setPatronEmailAddress("j.doe@hotmail.com");
105         oleNoticeBo.setPatronPhoneNumber("712-123-2145");
106 
107         oleNoticeBo.setTitle("History of Mars");
108         oleNoticeBo.setAuthor("Mary Jane");
109         oleNoticeBo.setVolumeNumber("v1.0");
110         oleNoticeBo.setDueDateString(new Date().toString());
111         oleNoticeBo.setItemShelvingLocation("UC/JRL/GEN");
112         oleNoticeBo.setItemCallNumber("X-123");
113         oleNoticeBo.setItemId("1234");
114         oleNoticeBo.setNoticeSpecificContent("This is a test notice. Please ignore!!");
115         oleNoticeBo.setNoticeTitle("Overdue Notice");
116 
117         OleNoticeBo oleNoticeBo1 = (OleNoticeBo) oleNoticeBo.clone();
118         List<OleNoticeBo> oleNoticeBos = new ArrayList<>();
119         oleNoticeBos.add(oleNoticeBo);
120         oleNoticeBos.add(oleNoticeBo1);
121 
122         OleNoticeContentConfigurationBo oleNoticeContentConfigurationBo = new OleNoticeContentConfigurationBo();
123         oleNoticeContentConfigurationBo.setActive(true);
124         oleNoticeContentConfigurationBo.setNoticeName("OverdueNotice");
125         oleNoticeContentConfigurationBo.setNoticeTitle("OverdueNotice");
126         oleNoticeContentConfigurationBo.setNoticeType("OverdueNotice");
127 
128         ArrayList<OleNoticeFieldLabelMapping> oleNoticeFieldLabelMappings = new ArrayList<>();
129 
130         OleNoticeFieldLabelMapping patronName = new OleNoticeFieldLabelMapping();
131         patronName.setFieldLabel("Patron Full Name");
132         patronName.setFieldName(OLEConstants.PATRON_NAME);
133 
134 
135         OleNoticeFieldLabelMapping address = new OleNoticeFieldLabelMapping();
136         address.setFieldLabel("Patron Address");
137         address.setFieldName(OLEConstants.NOTICE_ADDRESS);
138 
139 
140         OleNoticeFieldLabelMapping phoneNumber = new OleNoticeFieldLabelMapping();
141         phoneNumber.setFieldLabel("Patron Phone Number");
142         phoneNumber.setFieldName(OLEConstants.NOTICE_PHONE_NUMBER);
143 
144 
145 
146         OleNoticeFieldLabelMapping patronEmail = new OleNoticeFieldLabelMapping();
147         patronEmail.setFieldLabel("Valid Email Id");
148         patronEmail.setFieldName(OLEConstants.NOTICE_EMAIL);
149 
150 
151         OleNoticeFieldLabelMapping itemCallNum = new OleNoticeFieldLabelMapping();
152         itemCallNum.setFieldLabel("Item Call Number");
153         itemCallNum.setFieldName(OLEConstants.NOTICE_CALL_NUMBER);
154 
155         OleNoticeFieldLabelMapping title = new OleNoticeFieldLabelMapping();
156         title.setFieldLabel("Item Title");
157         title.setFieldName(OLEConstants.NOTICE_TITLE);
158 
159         OleNoticeFieldLabelMapping author = new OleNoticeFieldLabelMapping();
160         author.setFieldLabel("Item Author");
161         author.setFieldName(OLEConstants.NOTICE_AUTHOR);
162 
163         OleNoticeFieldLabelMapping itemBarcode = new OleNoticeFieldLabelMapping();
164         itemBarcode.setFieldLabel("Item Barcode");
165         itemBarcode.setFieldName(OLEConstants.NOTICE_ITEM_BARCODE);
166 
167         OleNoticeFieldLabelMapping itemDue = new OleNoticeFieldLabelMapping();
168         itemDue.setFieldLabel("Item Due Date");
169         itemDue.setFieldName(OLEConstants.ITEM_WAS_DUE);
170 
171 
172         OleNoticeFieldLabelMapping shelvingLocation = new OleNoticeFieldLabelMapping();
173         shelvingLocation.setFieldLabel("Shelving Location");
174         shelvingLocation.setFieldName(OLEConstants.LIBRARY_SHELVING_LOCATION);
175 
176         oleNoticeFieldLabelMappings.add(patronName);
177         oleNoticeFieldLabelMappings.add(address);
178         oleNoticeFieldLabelMappings.add(phoneNumber);
179         oleNoticeFieldLabelMappings.add(patronEmail);
180         oleNoticeFieldLabelMappings.add(itemCallNum);
181         oleNoticeFieldLabelMappings.add(title);
182         oleNoticeFieldLabelMappings.add(author);
183         oleNoticeFieldLabelMappings.add(itemBarcode);
184         oleNoticeFieldLabelMappings.add(itemDue);
185         oleNoticeFieldLabelMappings.add(shelvingLocation);
186 
187         oleNoticeContentConfigurationBo.setOleNoticeFieldLabelMappings(oleNoticeFieldLabelMappings);
188 
189         String html = noticeMailContentFormatter.generateHTML(oleNoticeBos, oleNoticeContentConfigurationBo);
190         assertNotNull(html);
191         System.out.println(html);
192     }
193 
194 
195     @Test
196     public void generateOverdueNoticeMailContentForPatron() throws Exception {
197         NoticeMailContentFormatter noticeMailContentFormatter = new MockOverdueNoticeEmailContentFormatter();
198         OleNoticeContentConfigurationBo oleNoticeContentConfigurationBo = new OleNoticeContentConfigurationBo();
199         oleNoticeContentConfigurationBo.setActive(true);
200         oleNoticeContentConfigurationBo.setNoticeName("OverdueNotice");
201         oleNoticeContentConfigurationBo.setNoticeTitle("OverdueNotice");
202         oleNoticeContentConfigurationBo.setNoticeType("OverdueNotice");
203         oleNoticeContentConfigurationBo.setNoticeBody("This is a test notice. Please ingore!");
204 
205         ArrayList<OleNoticeFieldLabelMapping> oleNoticeFieldLabelMappings = new ArrayList<>();
206 
207         OleNoticeFieldLabelMapping patronName = new OleNoticeFieldLabelMapping();
208         patronName.setFieldLabel("Patron Full Name");
209         patronName.setFieldName(OLEConstants.PATRON_NAME);
210 
211 
212         OleNoticeFieldLabelMapping address = new OleNoticeFieldLabelMapping();
213         address.setFieldLabel("Patron Address");
214         address.setFieldName(OLEConstants.NOTICE_ADDRESS);
215 
216 
217         OleNoticeFieldLabelMapping phoneNumber = new OleNoticeFieldLabelMapping();
218         phoneNumber.setFieldLabel("Patron Phone Number");
219         phoneNumber.setFieldName(OLEConstants.NOTICE_PHONE_NUMBER);
220 
221 
222 
223         OleNoticeFieldLabelMapping patronEmail = new OleNoticeFieldLabelMapping();
224         patronEmail.setFieldLabel("Valid Email Id");
225         patronEmail.setFieldName(OLEConstants.NOTICE_EMAIL);
226 
227 
228         OleNoticeFieldLabelMapping itemCallNum = new OleNoticeFieldLabelMapping();
229         itemCallNum.setFieldLabel("Item Call Number");
230         itemCallNum.setFieldName(OLEConstants.NOTICE_CALL_NUMBER);
231 
232         OleNoticeFieldLabelMapping title = new OleNoticeFieldLabelMapping();
233         title.setFieldLabel("Item Title");
234         title.setFieldName(OLEConstants.NOTICE_TITLE);
235 
236         OleNoticeFieldLabelMapping author = new OleNoticeFieldLabelMapping();
237         author.setFieldLabel("Item Author");
238         author.setFieldName(OLEConstants.NOTICE_AUTHOR);
239 
240         OleNoticeFieldLabelMapping itemBarcode = new OleNoticeFieldLabelMapping();
241         itemBarcode.setFieldLabel("Item Barcode");
242         itemBarcode.setFieldName(OLEConstants.NOTICE_ITEM_BARCODE);
243 
244         OleNoticeFieldLabelMapping itemDue = new OleNoticeFieldLabelMapping();
245         itemDue.setFieldLabel("Item Due Date");
246         itemDue.setFieldName(OLEConstants.ITEM_WAS_DUE);
247 
248 
249         OleNoticeFieldLabelMapping shelvingLocation = new OleNoticeFieldLabelMapping();
250         shelvingLocation.setFieldLabel("Shelving Location");
251         shelvingLocation.setFieldName(OLEConstants.LIBRARY_SHELVING_LOCATION);
252 
253         oleNoticeFieldLabelMappings.add(patronName);
254         oleNoticeFieldLabelMappings.add(address);
255         oleNoticeFieldLabelMappings.add(phoneNumber);
256         oleNoticeFieldLabelMappings.add(patronEmail);
257         oleNoticeFieldLabelMappings.add(itemCallNum);
258         oleNoticeFieldLabelMappings.add(title);
259         oleNoticeFieldLabelMappings.add(author);
260         oleNoticeFieldLabelMappings.add(itemBarcode);
261         oleNoticeFieldLabelMappings.add(itemDue);
262         oleNoticeFieldLabelMappings.add(shelvingLocation);
263 
264         oleNoticeContentConfigurationBo.setOleNoticeFieldLabelMappings(oleNoticeFieldLabelMappings);
265 
266         Mockito.when(mockOlePatronDocument.getPatronName()).thenReturn("John Doe");
267         Mockito.when(mockOlePatronDocument.getPreferredAddress()).thenReturn("123 High Street");
268         Mockito.when(mockOlePatronDocument.getEmailAddress()).thenReturn("jdoe@gmail.com");
269         Mockito.when(mockOlePatronDocument.getPhoneNumber()).thenReturn("123-233-2132");
270 
271         ArrayList locations = new ArrayList();
272         Mockito.when(mockOleLocation.getLocationName()).thenReturn("Regular Stacks");
273         locations.add(mockOleLocation);
274 
275         ArrayList<OleLoanDocument> oleLoanDocuments = new ArrayList<>();
276         Mockito.when(mockOleLoanDocument.getOlePatron()).thenReturn(mockOlePatronDocument);
277         Mockito.when(mockOleLoanDocument.getTitle()).thenReturn("History of Sceience");
278         Mockito.when(mockOleLoanDocument.getAuthor()).thenReturn("Mock Author");
279         Mockito.when(mockOleLoanDocument.getEnumeration()).thenReturn("v1ase.123");
280         Mockito.when(mockOleLoanDocument.getChronology()).thenReturn("chro123.12");
281         Mockito.when(mockOleLoanDocument.getItemVolumeNumber()).thenReturn("v.12");
282         Mockito.when(mockOleLoanDocument.getItemCallNumber()).thenReturn("123123");
283         Mockito.when(mockOleLoanDocument.getItemCopyNumber()).thenReturn("C0123.12");
284         Mockito.when(mockOleLoanDocument.getLoanDueDate()).thenReturn(new Timestamp(System.currentTimeMillis()));
285         oleLoanDocuments.add(mockOleLoanDocument);
286 
287 
288         Mockito.when(mockOleLoanDocument1.getOlePatron()).thenReturn(mockOlePatronDocument);
289         Mockito.when(mockOleLoanDocument1.getTitle()).thenReturn("History of War");
290         Mockito.when(mockOleLoanDocument1.getAuthor()).thenReturn("Mock Author1");
291         Mockito.when(mockOleLoanDocument1.getEnumeration()).thenReturn("v1ase.1231");
292         Mockito.when(mockOleLoanDocument1.getChronology()).thenReturn("chro123.12123");
293         Mockito.when(mockOleLoanDocument1.getItemVolumeNumber()).thenReturn("v.12123");
294         Mockito.when(mockOleLoanDocument1.getItemCallNumber()).thenReturn("12");
295         Mockito.when(mockOleLoanDocument1.getItemCopyNumber()).thenReturn("C0123.12");
296         Mockito.when(mockOleLoanDocument1.getLoanDueDate()).thenReturn(new Timestamp(System.currentTimeMillis()));
297         oleLoanDocuments.add(mockOleLoanDocument1);
298 
299 
300         String html = noticeMailContentFormatter.generateMailContentForPatron(oleLoanDocuments, oleNoticeContentConfigurationBo);
301         assertNotNull(html);
302         System.out.println(html);
303     }
304 
305     @Test
306     public void generateLostNoticeMailContentForPatron() throws Exception {
307         NoticeMailContentFormatter noticeMailContentFormatter = new MockLostNoticeEmailContentFormatter();
308         OleNoticeContentConfigurationBo oleNoticeContentConfigurationBo = new OleNoticeContentConfigurationBo();
309         oleNoticeContentConfigurationBo.setActive(true);
310         oleNoticeContentConfigurationBo.setNoticeName("OverdueNotice");
311         oleNoticeContentConfigurationBo.setNoticeTitle("OverdueNotice");
312         oleNoticeContentConfigurationBo.setNoticeType("OverdueNotice");
313         oleNoticeContentConfigurationBo.setNoticeBody("This is a test notice. Please ingore!");
314 
315         ArrayList<OleNoticeFieldLabelMapping> oleNoticeFieldLabelMappings = new ArrayList<>();
316 
317         OleNoticeFieldLabelMapping patronName = new OleNoticeFieldLabelMapping();
318         patronName.setFieldLabel("Patron Full Name");
319         patronName.setFieldName(OLEConstants.PATRON_NAME);
320 
321 
322         OleNoticeFieldLabelMapping address = new OleNoticeFieldLabelMapping();
323         address.setFieldLabel("Patron Address");
324         address.setFieldName(OLEConstants.NOTICE_ADDRESS);
325 
326 
327         OleNoticeFieldLabelMapping phoneNumber = new OleNoticeFieldLabelMapping();
328         phoneNumber.setFieldLabel("Patron Phone Number");
329         phoneNumber.setFieldName(OLEConstants.NOTICE_PHONE_NUMBER);
330 
331 
332 
333         OleNoticeFieldLabelMapping patronEmail = new OleNoticeFieldLabelMapping();
334         patronEmail.setFieldLabel("Valid Email Id");
335         patronEmail.setFieldName(OLEConstants.NOTICE_EMAIL);
336 
337 
338         OleNoticeFieldLabelMapping itemCallNum = new OleNoticeFieldLabelMapping();
339         itemCallNum.setFieldLabel("Item Call Number");
340         itemCallNum.setFieldName(OLEConstants.NOTICE_CALL_NUMBER);
341 
342         OleNoticeFieldLabelMapping title = new OleNoticeFieldLabelMapping();
343         title.setFieldLabel("Item Title");
344         title.setFieldName(OLEConstants.NOTICE_TITLE);
345 
346         OleNoticeFieldLabelMapping author = new OleNoticeFieldLabelMapping();
347         author.setFieldLabel("Item Author");
348         author.setFieldName(OLEConstants.NOTICE_AUTHOR);
349 
350         OleNoticeFieldLabelMapping itemBarcode = new OleNoticeFieldLabelMapping();
351         itemBarcode.setFieldLabel("Item Barcode");
352         itemBarcode.setFieldName(OLEConstants.NOTICE_ITEM_BARCODE);
353 
354         OleNoticeFieldLabelMapping itemDue = new OleNoticeFieldLabelMapping();
355         itemDue.setFieldLabel("Item Due Date");
356         itemDue.setFieldName(OLEConstants.ITEM_WAS_DUE);
357 
358         OleNoticeFieldLabelMapping billNumber = new OleNoticeFieldLabelMapping();
359         billNumber.setFieldLabel("Bill Number");
360         billNumber.setFieldName("Bill Number");
361 
362         OleNoticeFieldLabelMapping feeType = new OleNoticeFieldLabelMapping();
363         feeType.setFieldLabel("Fee Type");
364         feeType.setFieldName("Fee Type");
365 
366         OleNoticeFieldLabelMapping feeAmount = new OleNoticeFieldLabelMapping();
367         feeAmount.setFieldLabel("Fee Amount");
368         feeAmount.setFieldName("Fee Amount");
369 
370 
371         OleNoticeFieldLabelMapping shelvingLocation = new OleNoticeFieldLabelMapping();
372         shelvingLocation.setFieldLabel("Shelving Location");
373         shelvingLocation.setFieldName(OLEConstants.LIBRARY_SHELVING_LOCATION);
374 
375         oleNoticeFieldLabelMappings.add(patronName);
376         oleNoticeFieldLabelMappings.add(address);
377         oleNoticeFieldLabelMappings.add(phoneNumber);
378         oleNoticeFieldLabelMappings.add(patronEmail);
379         oleNoticeFieldLabelMappings.add(itemCallNum);
380         oleNoticeFieldLabelMappings.add(title);
381         oleNoticeFieldLabelMappings.add(author);
382         oleNoticeFieldLabelMappings.add(itemBarcode);
383         oleNoticeFieldLabelMappings.add(itemDue);
384         oleNoticeFieldLabelMappings.add(shelvingLocation);
385         oleNoticeFieldLabelMappings.add(billNumber);
386         oleNoticeFieldLabelMappings.add(feeType);
387         oleNoticeFieldLabelMappings.add(feeAmount);
388 
389         oleNoticeContentConfigurationBo.setOleNoticeFieldLabelMappings(oleNoticeFieldLabelMappings);
390 
391         Mockito.when(mockOlePatronDocument.getPatronName()).thenReturn("John Doe");
392         Mockito.when(mockOlePatronDocument.getPreferredAddress()).thenReturn("123 High Street");
393         Mockito.when(mockOlePatronDocument.getEmailAddress()).thenReturn("jdoe@gmail.com");
394         Mockito.when(mockOlePatronDocument.getPhoneNumber()).thenReturn("123-233-2132");
395 
396         ArrayList locations = new ArrayList();
397         Mockito.when(mockOleLocation.getLocationName()).thenReturn("Regular Stacks");
398         locations.add(mockOleLocation);
399 
400         ArrayList<OleLoanDocument> oleLoanDocuments = new ArrayList<>();
401         Mockito.when(mockOleLoanDocument.getOlePatron()).thenReturn(mockOlePatronDocument);
402         Mockito.when(mockOleLoanDocument.getTitle()).thenReturn("History of Sceience");
403         Mockito.when(mockOleLoanDocument.getAuthor()).thenReturn("Mock Author");
404         Mockito.when(mockOleLoanDocument.getEnumeration()).thenReturn("v1ase.123");
405         Mockito.when(mockOleLoanDocument.getChronology()).thenReturn("chro123.12");
406         Mockito.when(mockOleLoanDocument.getItemVolumeNumber()).thenReturn("v.12");
407         Mockito.when(mockOleLoanDocument.getItemCallNumber()).thenReturn("123123");
408         Mockito.when(mockOleLoanDocument.getItemCopyNumber()).thenReturn("C0123.12");
409         Mockito.when(mockOleLoanDocument.getLoanDueDate()).thenReturn(new Timestamp(System.currentTimeMillis()));
410         Mockito.when(mockOleLoanDocument.getReplacementBill()).thenReturn(new BigDecimal(21.00));
411         Mockito.when(mockOleLoanDocument.getRepaymentFeePatronBillId()).thenReturn("123");
412         oleLoanDocuments.add(mockOleLoanDocument);
413 
414 
415         Mockito.when(mockOleLoanDocument1.getOlePatron()).thenReturn(mockOlePatronDocument);
416         Mockito.when(mockOleLoanDocument1.getTitle()).thenReturn("History of War");
417         Mockito.when(mockOleLoanDocument1.getAuthor()).thenReturn("Mock Author1");
418         Mockito.when(mockOleLoanDocument1.getEnumeration()).thenReturn("v1ase.1231");
419         Mockito.when(mockOleLoanDocument1.getChronology()).thenReturn("chro123.12123");
420         Mockito.when(mockOleLoanDocument1.getItemVolumeNumber()).thenReturn("v.12123");
421         Mockito.when(mockOleLoanDocument1.getItemCallNumber()).thenReturn("12");
422         Mockito.when(mockOleLoanDocument1.getItemCopyNumber()).thenReturn("C0123.12");
423         Mockito.when(mockOleLoanDocument1.getLoanDueDate()).thenReturn(new Timestamp(System.currentTimeMillis()));
424         Mockito.when(mockOleLoanDocument1.getLoanDueDate()).thenReturn(new Timestamp(System.currentTimeMillis()));
425         Mockito.when(mockOleLoanDocument1.getReplacementBill()).thenReturn(new BigDecimal(21.00));
426         Mockito.when(mockOleLoanDocument1.getRepaymentFeePatronBillId()).thenReturn("123");
427         oleLoanDocuments.add(mockOleLoanDocument1);
428 
429 
430         String html = noticeMailContentFormatter.generateMailContentForPatron(oleLoanDocuments, oleNoticeContentConfigurationBo);
431         assertNotNull(html);
432         System.out.println(html);
433     }
434 
435     public class MockNoticeMailContentFormatter extends NoticeMailContentFormatter {
436         @Override
437         protected SimpleDateFormat getSimpleDateFormat() {
438             return  new SimpleDateFormat();
439         }
440 
441         @Override
442         protected void processCustomNoticeInfo(OleLoanDocument oleLoanDocument, OleNoticeBo oleNoticeBo){
443         }
444     }
445 
446 
447     class MockOverdueNoticeEmailContentFormatter extends NoticeMailContentFormatter {
448         @Override
449         protected void processCustomNoticeInfo(OleLoanDocument oleLoanDocument, OleNoticeBo oleNoticeBo) {
450 
451         }
452 
453         @Override
454         protected String getLocationName(String code) {
455             return "Stacks Regular";
456         }
457     }
458 
459     class MockLostNoticeEmailContentFormatter extends NoticeMailContentFormatter {
460         @Override
461         protected void processCustomNoticeInfo(OleLoanDocument oleLoanDocument, OleNoticeBo oleNoticeBo) {
462             oleNoticeBo.setNoticeTitle("Lost");
463             oleNoticeBo.setBillNumber(oleLoanDocument.getRepaymentFeePatronBillId());
464             oleNoticeBo.setFeeType("Replacement Bill");
465             oleNoticeBo.setFeeAmount(oleLoanDocument.getReplacementBill());
466         }
467 
468         @Override
469         protected String getLocationName(String code) {
470             return "Stacks Regular";
471         }
472     }
473 }