Source Code Cross Referenced for PropertyDictionaryTest.java in  » XML » xstream-1.3 » com » thoughtworks » xstream » converters » javabean » 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 » XML » xstream 1.3 » com.thoughtworks.xstream.converters.javabean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2005 Joe Walnes.
003:         * Copyright (C) 2006, 2007 XStream Committers.
004:         * All rights reserved.
005:         *
006:         * The software in this package is published under the terms of the BSD
007:         * style license a copy of which has been included with this distribution in
008:         * the LICENSE.txt file.
009:         * 
010:         * Created on 12. April 2005 by Joe Walnes
011:         */
012:        package com.thoughtworks.xstream.converters.javabean;
013:
014:        import junit.framework.TestCase;
015:
016:        import java.util.Iterator;
017:
018:        public class PropertyDictionaryTest extends TestCase {
019:
020:            private PropertyDictionary propertyDictionary;
021:
022:            protected void setUp() throws Exception {
023:                super .setUp();
024:                propertyDictionary = new PropertyDictionary();
025:            }
026:
027:            /**
028:             * Test class: three serializable properties, one with a all capital name,
029:             * two others non serializable, one readable, one writable, and another and
030:             * a lonely field
031:             */
032:            class SomeClass {
033:                private String a;
034:
035:                private String URL;
036:
037:                private String c;
038:
039:                private String d;
040:
041:                private String e;
042:
043:                private String f;
044:
045:                public String getA() {
046:                    return a;
047:                }
048:
049:                public void setA(String a) {
050:                    this .a = a;
051:                }
052:
053:                public String getURL() {
054:                    return URL;
055:                }
056:
057:                public void setURL(String url) {
058:                    this .URL = url;
059:                }
060:
061:                public String getC() {
062:                    return c;
063:                }
064:
065:                public void setC(String c) {
066:                    this .c = c;
067:                }
068:
069:                public String getD() {
070:                    return d;
071:                }
072:
073:                public void setE(String e) {
074:                    this .e = e;
075:                }
076:            }
077:
078:            public void testListsFieldsInClassInDefinitionOrder() {
079:                Iterator properties = propertyDictionary
080:                        .serializablePropertiesFor(SomeClass.class);
081:                assertEquals("URL", ((BeanProperty) properties.next())
082:                        .getName());
083:                assertEquals("a", ((BeanProperty) properties.next()).getName());
084:                assertEquals("c", ((BeanProperty) properties.next()).getName());
085:                assertFalse("No more fields should be present", properties
086:                        .hasNext());
087:            }
088:
089:            /**
090:             * Test subclassing and private properties
091:             */
092:            class SpecialClass extends SomeClass {
093:                private String brilliant;
094:
095:                public String getBrilliant() {
096:                    return brilliant;
097:                }
098:
099:                public void setBrilliant(String brilliant) {
100:                    this .brilliant = brilliant;
101:                }
102:
103:                public String getPrivate() {
104:                    return null;
105:                }
106:
107:                private void setPrivate(String string) {
108:
109:                }
110:            }
111:
112:            public void testIncludesFieldsInSuperClasses() {
113:                Iterator properties = propertyDictionary
114:                        .serializablePropertiesFor(SpecialClass.class);
115:                assertEquals("URL", ((BeanProperty) properties.next())
116:                        .getName());
117:                assertEquals("a", ((BeanProperty) properties.next()).getName());
118:                assertEquals("brilliant", ((BeanProperty) properties.next())
119:                        .getName());
120:                assertEquals("c", ((BeanProperty) properties.next()).getName());
121:                assertFalse("No more fields should be present", properties
122:                        .hasNext());
123:            }
124:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.