View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.inquiry;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.junit.Test;
20  import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
21  import org.kuali.rice.kns.lookup.HtmlData;
22  import org.kuali.rice.krad.test.document.bo.AccountManager;
23  import org.kuali.test.KRADTestCase;
24  
25  import static org.junit.Assert.assertTrue;
26  
27  /**
28   * This class tests the KualiInquirable methods.
29   * 
30   * 
31   */
32  public class KualiInquirableTest extends KRADTestCase {
33  
34      private AccountManager am;
35  
36      @Override
37      public void setUp() throws Exception {
38          super.setUp();
39          am = new AccountManager();
40          am.setAmId(new Long(1));
41          
42      }
43  
44      /**
45       * Tests the inquiry url output for a given bo and property name.
46       */
47      @Test public final void testBuildInquiryUrl() {
48      	String inquiryUrl = ((HtmlData.AnchorHtmlData)new KualiInquirableImpl().getInquiryUrl(am, "amId", true)).getHref();
49          assertTrue("An inquiry URL to AccountManager should be built", StringUtils.contains(inquiryUrl, "amId=1"));
50          assertTrue("An inquiry URL to AccountManager should be built", StringUtils.contains(inquiryUrl, "businessObjectClassName=" + AccountManager.class.getName()));
51      }
52  
53  }