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