Source Code Cross Referenced for MVELClassFieldExtractorTest.java in  » Rule-Engine » drolls-Rule-Engine » org » drools » base » extractors » 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 » Rule Engine » drolls Rule Engine » org.drools.base.extractors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.drools.base.extractors;
002:
003:        import junit.framework.Assert;
004:        import junit.framework.TestCase;
005:
006:        import org.drools.Address;
007:        import org.drools.Person;
008:        import org.drools.base.ClassFieldExtractorCache;
009:        import org.drools.spi.Extractor;
010:
011:        public class MVELClassFieldExtractorTest extends TestCase {
012:
013:            Extractor extractor = ClassFieldExtractorCache.getExtractor(
014:                    Person.class, "addresses['home'].street", getClass()
015:                            .getClassLoader());
016:            Person person = null;
017:
018:            protected void setUp() throws Exception {
019:                super .setUp();
020:                person = new Person("bob", 30);
021:                Address business = new Address("Business Street", "999", null);
022:                Address home = new Address("Home Street", "555", "55555555");
023:                person.getAddresses().put("business", business);
024:                person.getAddresses().put("home", home);
025:            }
026:
027:            public void testGetBooleanValue() {
028:                try {
029:                    this .extractor.getBooleanValue(null, this .person);
030:                    fail("Should have throw an exception");
031:                } catch (final Exception e) {
032:                    // success
033:                }
034:            }
035:
036:            public void testGetByteValue() {
037:                try {
038:                    this .extractor.getByteValue(null, this .person);
039:                    fail("Should have throw an exception");
040:                } catch (final Exception e) {
041:                    // success
042:                }
043:            }
044:
045:            public void testGetCharValue() {
046:                try {
047:                    this .extractor.getCharValue(null, this .person);
048:                    fail("Should have throw an exception");
049:                } catch (final Exception e) {
050:                    // success
051:                }
052:            }
053:
054:            public void testGetDoubleValue() {
055:                try {
056:                    this .extractor.getDoubleValue(null, this .person);
057:                    fail("Should have throw an exception");
058:                } catch (final Exception e) {
059:                    // success
060:                }
061:            }
062:
063:            public void testGetFloatValue() {
064:                try {
065:                    this .extractor.getFloatValue(null, this .person);
066:                    fail("Should have throw an exception");
067:                } catch (final Exception e) {
068:                    // success
069:                }
070:            }
071:
072:            public void testGetIntValue() {
073:                try {
074:                    this .extractor.getIntValue(null, this .person);
075:                    fail("Should have throw an exception");
076:                } catch (final Exception e) {
077:                    // success
078:                }
079:            }
080:
081:            public void testGetLongValue() {
082:                try {
083:                    this .extractor.getLongValue(null, this .person);
084:                    fail("Should have throw an exception");
085:                } catch (final Exception e) {
086:                    // success
087:                }
088:            }
089:
090:            public void testGetShortValue() {
091:                try {
092:                    this .extractor.getShortValue(null, this .person);
093:                    fail("Should have throw an exception");
094:                } catch (final Exception e) {
095:                    // success
096:                }
097:            }
098:
099:            public void testGetValue() {
100:                try {
101:                    Assert.assertEquals("Home Street", this .extractor.getValue(
102:                            null, this .person));
103:                    Assert.assertTrue(this .extractor
104:                            .getValue(null, this .person) instanceof  String);
105:                } catch (final Exception e) {
106:                    fail("Should not throw an exception");
107:                }
108:            }
109:
110:            public void testIsNullValue() {
111:                try {
112:                    Assert.assertFalse(this .extractor.isNullValue(null,
113:                            this .person));
114:
115:                    Extractor nullExtractor = ClassFieldExtractorCache
116:                            .getExtractor(Person.class,
117:                                    "addresses['business'].phone", getClass()
118:                                            .getClassLoader());
119:                    Assert.assertTrue(nullExtractor.isNullValue(null,
120:                            this .person));
121:                } catch (final Exception e) {
122:                    fail("Should not throw an exception");
123:                }
124:            }
125:
126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.