1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.widget;
17
18 import org.junit.Test;
19 import org.kuali.rice.core.api.CoreApiServiceLocator;
20 import org.kuali.rice.kim.api.identity.Person;
21 import org.kuali.rice.krad.test.document.BOContainingPerson;
22 import org.kuali.rice.krad.uif.element.Action;
23 import org.kuali.rice.krad.uif.element.Link;
24 import org.kuali.rice.krad.util.KRADConstants;
25 import org.kuali.rice.krad.test.KRADTestCase;
26
27 import java.util.HashMap;
28 import java.util.Map;
29
30 import static org.junit.Assert.assertEquals;
31 import static org.junit.Assert.assertNotNull;
32
33
34
35
36 public class InquiryTest extends KRADTestCase{
37 @Test
38
39
40
41 public void testBuildInquiryUrl_relatedClass() {
42 Inquiry inquiry = new Inquiry();
43 inquiry.setParentReadOnly(true);
44 inquiry.setInquiryLink(new Link());
45 inquiry.setDirectInquiryAction(new Action());
46 String baseInquiryUrl = CoreApiServiceLocator.getKualiConfigurationService().getPropertyValueAsString(
47 KRADConstants.APPLICATION_URL_KEY);
48 inquiry.setBaseInquiryUrl(baseInquiryUrl);
49 Map<String, String> params = new HashMap<String, String>();
50 params.put("principalId", "principalId");
51 BOContainingPerson dataObject = new BOContainingPerson();
52 dataObject.setPrincipalId("en");
53 inquiry.buildInquiryLink(dataObject, "principalId", Person.class, params);
54
55 assertNotNull("InquiryLink should not be null", inquiry.getInquiryLink());
56 assertNotNull("InquiryLink's href should not be null", inquiry.getInquiryLink().getHref());
57 String expectedHref = baseInquiryUrl +
58 "/kr-krad/inquiry?principalId=en&methodToCall=start&dataObjectClassName=org.kuali.rice.kim.impl.identity.PersonImpl";
59 assertEquals("InquiryLink's href is not the expected value", expectedHref, inquiry.getInquiryLink().getHref());
60 }
61 }