001    /**
002     * Copyright 2005-2011 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krad.inquiry;
017    
018    import org.apache.commons.lang.StringUtils;
019    import org.junit.Test;
020    import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
021    import org.kuali.rice.kns.lookup.HtmlData;
022    import org.kuali.rice.krad.test.document.bo.AccountManager;
023    import org.kuali.test.KRADTestCase;
024    
025    import static org.junit.Assert.assertTrue;
026    
027    /**
028     * KualiInquirableTest tests {@link KualiInquirableImpl} methods
029     * 
030     * 
031     */
032    public class KualiInquirableTest extends KRADTestCase {
033    
034        private AccountManager am;
035    
036        @Override
037        public void setUp() throws Exception {
038            super.setUp();
039            am = new AccountManager();
040            am.setAmId(new Long(1));
041            
042        }
043    
044        /**
045         * Tests the inquiry url output for a given bo and property name
046         */
047        @Test public final void testBuildInquiryUrl() {
048            String inquiryUrl = ((HtmlData.AnchorHtmlData)new KualiInquirableImpl().getInquiryUrl(am, "amId", true)).getHref();
049            assertTrue("An inquiry URL to AccountManager should be built", StringUtils.contains(inquiryUrl, "amId=1"));
050            assertTrue("An inquiry URL to AccountManager should be built", StringUtils.contains(inquiryUrl, "businessObjectClassName=" + AccountManager.class.getName()));
051        }
052    
053    }