Source Code Cross Referenced for FederalFundedCodeServiceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » core » service » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.core.service 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.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/ecl1.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.core.service;
017:
018:        import org.kuali.kfs.context.KualiTestBase;
019:        import org.kuali.kfs.context.SpringContext;
020:        import org.kuali.kfs.service.KualiCodeService;
021:        import org.kuali.module.chart.bo.codes.FederalFundedCode;
022:        import org.kuali.test.ConfigureContext;
023:
024:        /**
025:         * This class tests the FederalFundedCode service.
026:         */
027:
028:        @ConfigureContext
029:        public class FederalFundedCodeServiceTest extends KualiTestBase {
030:
031:            private FederalFundedCode ffc;
032:
033:            /**
034:             * Performs all tests for this service.
035:             */
036:            public void testGetByCode_valid_code() {
037:                ffc = null;
038:                ffc = (FederalFundedCode) SpringContext.getBean(
039:                        KualiCodeService.class).getByCode(
040:                        FederalFundedCode.class,
041:                        TestConstants.Data5.FEDERAL_FUNDED_CODE1);
042:                assertNotNull(ffc);
043:                assertEquals(
044:                        "Known-good code results in expected returned Name.",
045:                        TestConstants.Data5.FEDERAL_FUNDED_NAME1, ffc.getName());
046:            }
047:
048:            public void testGetByName_valid_name() {
049:                ffc = null;
050:                ffc = (FederalFundedCode) SpringContext.getBean(
051:                        KualiCodeService.class).getByName(
052:                        FederalFundedCode.class,
053:                        TestConstants.Data5.FEDERAL_FUNDED_NAME1);
054:                assertEquals(
055:                        "Known-good name results in expected returned code.",
056:                        TestConstants.Data5.FEDERAL_FUNDED_CODE1, ffc.getCode());
057:            }
058:
059:            public void testGetByCode_invalid_code() {
060:                ffc = null;
061:                ffc = (FederalFundedCode) SpringContext.getBean(
062:                        KualiCodeService.class).getByCode(
063:                        FederalFundedCode.class,
064:                        TestConstants.Data5.FEDERAL_FUNDED_CODE_BAD);
065:                assertNull("Known-bad code returns null object.", ffc);
066:            }
067:
068:            public void testGetByName_invalid_name() {
069:                ffc = null;
070:                ffc = (FederalFundedCode) SpringContext.getBean(
071:                        KualiCodeService.class).getByName(
072:                        FederalFundedCode.class,
073:                        TestConstants.Data5.FEDERAL_FUNDED_NAME_BAD);
074:                assertNull("Known-bad name returns null object.", ffc);
075:            }
076:
077:            public void testGetByCode_blank_code() {
078:                ffc = null;
079:                ffc = (FederalFundedCode) SpringContext.getBean(
080:                        KualiCodeService.class).getByCode(
081:                        FederalFundedCode.class, "");
082:                assertNull("Known-empty code returns null object.", ffc);
083:            }
084:
085:            public void testGetByCode_null_code() {
086:                ffc = null;
087:                ffc = (FederalFundedCode) SpringContext.getBean(
088:                        KualiCodeService.class).getByCode(
089:                        FederalFundedCode.class, null);
090:                assertNull("Known-null code returns null object.", ffc);
091:            }
092:
093:            /*
094:             * This method was removed because: 1. Adding new FederalFundedCodes is extremely rare-- this test is not particularly valuable
095:             * 2. The old test was broken in several ways: a. it did not clean up after itself ala dbunit b. the resolution of the timestamp
096:             * to modify the name was too low-- the test could only be run successfully once per day c. the final assertion ignored the fact
097:             * that the new name had been intentionally altered-- it expected the old name to still be there d. the deep copied object had
098:             * the same primary key as the one intended to replace it public void testSave() { ffc = null; FederalFundedCode result = null;
099:             * String timestamp = DateFormat.getDateInstance().format(new Date()); try { String newName = null; // get the existing value
100:             * ffc = (FederalFundedCode) kualiCodeService.getByCode(FederalFundedCode.class, TestConstants.Data5.FEDERAL_FUNDED_CODE1); //
101:             * cache the old value, create a new value, and modify the object result = (FederalFundedCode)ObjectUtils.deepCopy(ffc) ;
102:             * newName = ffc.getName() + ":"+timestamp; result.setName(newName); // attempt to save the modified object
103:             * kualiCodeService.save(result); // open the object byCode() and confirm that the changes were saved result =
104:             * (FederalFundedCode) kualiCodeService.getByCode(FederalFundedCode.class, TestConstants.Data5.FEDERAL_FUNDED_CODE1);
105:             * assertEquals("Changes to the document were not persisted to the database.", newName, ffc.getName()); } finally { if (ffc !=
106:             * null) { kualiCodeService.save(ffc); result = (FederalFundedCode) kualiCodeService.getByCode(FederalFundedCode.class,
107:             * TestConstants.Data5.FEDERAL_FUNDED_CODE1); assertEquals("Changes to the document were not persisted to the database.",
108:             * ffc.getName(), result.getName()); } } }
109:             */
110:
111:            public void testActive() {
112:                // test known-good active code
113:                ffc = null;
114:                ffc = (FederalFundedCode) SpringContext.getBean(
115:                        KualiCodeService.class).getByCode(
116:                        FederalFundedCode.class,
117:                        TestConstants.Data5.FEDERAL_FUNDED_CODE1);
118:                assertTrue(
119:                        "The active code associated with this field is incorrect",
120:                        ffc.isActive());
121:
122:            }
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.