1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.enrollment.class2.acal.service.impl;
17
18 import org.junit.Test;
19 import org.kuali.student.enrollment.acal.dto.TermInfo;
20 import org.kuali.student.enrollment.class2.acal.service.TermCodeGenerator;
21 import org.kuali.student.r2.core.constants.AtpServiceConstants;
22
23 import java.text.SimpleDateFormat;
24 import java.util.Date;
25
26 import static org.junit.Assert.assertEquals;
27
28
29
30
31
32
33 public class TestTermCodeGeneratorImpl {
34 @Test
35 public void testTermCodeGenerator(){
36 TermCodeGenerator tcg = new TermCodeGeneratorImpl();
37 TermInfo term = new TermInfo();
38 term.setStartDate(new Date());
39 term.setTypeKey(AtpServiceConstants.ATP_WINTER_TYPE_KEY);
40 String termCode = tcg.generateTermCode(term);
41
42 SimpleDateFormat formatter = new SimpleDateFormat("yyyy");
43 String startYear = formatter.format(new Date());
44 assertEquals(startYear + "1",termCode);
45 }
46 }