1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.lum.lrc.dao.impl;
17
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertNotNull;
20 import static org.junit.Assert.assertTrue;
21
22 import java.util.List;
23
24 import org.junit.Test;
25 import org.kuali.student.common.exceptions.DoesNotExistException;
26 import org.kuali.student.common.test.spring.AbstractTransactionalDaoTest;
27 import org.kuali.student.common.test.spring.Dao;
28 import org.kuali.student.common.test.spring.PersistenceFileLocation;
29 import org.kuali.student.lum.lrc.dao.LrcDao;
30 import org.kuali.student.lum.lrc.entity.ResultComponentType;
31
32 @PersistenceFileLocation("classpath:META-INF/lrc-persistence.xml")
33 public class TestLrcDaoImpl extends AbstractTransactionalDaoTest {
34 @Dao(value = "org.kuali.student.lum.lrc.dao.impl.LrcDaoImpl", testSqlFile = "classpath:ks-lrc.sql")
35 public LrcDao dao;
36
37 @Test
38 public void testGetResultComponentIdsByResult() {
39 List<String> rcis = dao.getResultComponentIdsByResult("LRC-RESULT_VALUE-CREDIT-1", "resultComponentType.credential");
40 assertNotNull(rcis);
41 assertEquals(1, rcis.size());
42
43 rcis = dao.getResultComponentIdsByResult("LRC-RESULT_VALUE-CREDIT-1x", "resultComponentType.credential");
44 assertTrue(rcis.isEmpty());
45
46 rcis = dao.getResultComponentIdsByResult("LRC-RESULT_VALUE-CREDIT-1", "resultComponentType.credentialx");
47 assertTrue(rcis.isEmpty());
48 }
49
50 @Test
51 public void testGetResultComponentIdsByResultComponentType() {
52 List<String> rcis = dao.getResultComponentIdsByResultComponentType("resultComponentType.credential");
53 assertNotNull(rcis);
54 assertEquals(1, rcis.size());
55
56 rcis = dao.getResultComponentIdsByResultComponentType("resultComponentType.credentialx");
57 assertTrue(rcis.isEmpty());
58 }
59
60 @Test
61 public void testGetResultComponentType() {
62 try {
63 @SuppressWarnings("unused")
64 ResultComponentType rcti = dao.getResultComponentType("resultComponentType.credential");
65 assertTrue(true);
66 } catch (DoesNotExistException e) {
67 assertTrue(false);
68 }
69
70 try {
71 @SuppressWarnings("unused")
72 ResultComponentType rcti = dao.getResultComponentType("resultComponentType.credentialYYY");
73 assertTrue(false);
74 } catch (DoesNotExistException e) {
75 assertTrue(true);
76 }
77
78 }
79 }