Source Code Cross Referenced for TestBeanUtils.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » tools » 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 » Web Framework » rife 1.6.1 » com.uwyn.rife.tools 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
0003:         * Distributed under the terms of either:
0004:         * - the common development and distribution license (CDDL), v1.0; or
0005:         * - the GNU Lesser General Public License, v2.1 or later
0006:         * $Id: TestBeanUtils.java 3700 2007-03-17 18:20:59Z gbevin $
0007:         */
0008:        package com.uwyn.rife.tools;
0009:
0010:        import com.uwyn.rife.config.RifeConfig;
0011:        import com.uwyn.rife.tools.BeanImpl;
0012:        import com.uwyn.rife.tools.BeanUtils;
0013:        import com.uwyn.rife.tools.exceptions.BeanUtilsException;
0014:        import com.uwyn.rife.tools.exceptions.SerializationUtilsErrorException;
0015:        import java.beans.PropertyDescriptor;
0016:        import java.math.BigDecimal;
0017:        import java.sql.Time;
0018:        import java.sql.Timestamp;
0019:        import java.text.ParseException;
0020:        import java.util.Arrays;
0021:        import java.util.Calendar;
0022:        import java.util.Date;
0023:        import java.util.Map;
0024:        import java.util.Set;
0025:        import junit.framework.TestCase;
0026:
0027:        public class TestBeanUtils extends TestCase {
0028:            public TestBeanUtils(String name) {
0029:                super (name);
0030:            }
0031:
0032:            private BeanImpl getPopulatedBean() {
0033:                BeanImpl bean = new BeanImpl();
0034:                Calendar cal = Calendar.getInstance();
0035:                cal.set(2002, 11, 26, 22, 52, 31);
0036:                cal.set(Calendar.MILLISECOND, 153);
0037:                bean.setPropertyString("thisisastring");
0038:                bean.setPropertyStringbuffer(new StringBuffer(
0039:                        "butthisisastringbuffer"));
0040:                bean.setPropertyDate(cal.getTime());
0041:                bean.setPropertyCalendar(cal);
0042:                bean.setPropertySqlDate(new java.sql.Date(cal.getTime()
0043:                        .getTime()));
0044:                bean.setPropertyTime(new Time(cal.getTime().getTime()));
0045:                bean
0046:                        .setPropertyTimestamp(new Timestamp(cal.getTime()
0047:                                .getTime()));
0048:                bean.setPropertyChar('g');
0049:                bean.setPropertyBoolean(false);
0050:                bean.setPropertyByte((byte) 53);
0051:                bean.setPropertyDouble(84578.42d);
0052:                bean.setPropertyFloat(35523.967f);
0053:                bean.setPropertyInt(978);
0054:                bean.setPropertyLong(87346L);
0055:                bean.setPropertyShort((short) 31);
0056:                bean.setPropertyBigDecimal(new BigDecimal(
0057:                        "8347365990.387437894678"));
0058:
0059:                return bean;
0060:            }
0061:
0062:            public void testSetUppercaseBeanPropertyIllegalArguments()
0063:                    throws BeanUtilsException {
0064:                Map<String, PropertyDescriptor> bean_properties = BeanUtils
0065:                        .getUppercasedBeanProperties(BeanImpl2.class);
0066:
0067:                try {
0068:                    BeanUtils.setUppercasedBeanProperty(null, null, null,
0069:                            bean_properties, new BeanImpl2(), null);
0070:                    fail("IllegalArgumentException expected.");
0071:                } catch (IllegalArgumentException e) {
0072:                }
0073:
0074:                try {
0075:                    BeanUtils.setUppercasedBeanProperty("propertyString", null,
0076:                            null, null, new BeanImpl2(), null);
0077:                    fail("IllegalArgumentException expected.");
0078:                } catch (IllegalArgumentException e) {
0079:                }
0080:
0081:                try {
0082:                    BeanUtils.setUppercasedBeanProperty("propertyString", null,
0083:                            null, bean_properties, null, null);
0084:                    fail("IllegalArgumentException expected.");
0085:                } catch (IllegalArgumentException e) {
0086:                }
0087:
0088:                try {
0089:                    BeanUtils.setUppercasedBeanProperty("propertyString", null,
0090:                            null, bean_properties, new BeanImpl2(), null);
0091:                } catch (IllegalArgumentException e) {
0092:                    fail("IllegalArgumentException not expected.");
0093:                }
0094:            }
0095:
0096:            public void testSetUppercaseBeanPropertyNoOpArguments()
0097:                    throws BeanUtilsException {
0098:                BeanImpl2 bean;
0099:                Map<String, PropertyDescriptor> bean_properties = BeanUtils
0100:                        .getUppercasedBeanProperties(BeanImpl2.class);
0101:
0102:                bean = new BeanImpl2();
0103:                BeanUtils.setUppercasedBeanProperty("propertyString", null,
0104:                        null, bean_properties, bean, null);
0105:                assertNull(bean.getPropertyString());
0106:
0107:                bean = new BeanImpl2();
0108:                BeanUtils.setUppercasedBeanProperty("propertyString",
0109:                        new String[0], null, bean_properties, bean, null);
0110:                assertNull(bean.getPropertyString());
0111:
0112:                bean = new BeanImpl2();
0113:                BeanUtils.setUppercasedBeanProperty("propertyString",
0114:                        new String[] { "one", "two" }, null, bean_properties,
0115:                        bean, new BeanImpl2());
0116:                assertEquals(bean.getPropertyString(), "one");
0117:            }
0118:
0119:            public void testSetUppercaseBeanPropertyNoSetter()
0120:                    throws BeanUtilsException {
0121:                BeanImpl2 bean;
0122:                Map<String, PropertyDescriptor> bean_properties = BeanUtils
0123:                        .getUppercasedBeanProperties(BeanImpl2.class);
0124:
0125:                bean = new BeanImpl2();
0126:                assertEquals(bean.getPropertyReadonly(), 23L);
0127:                BeanUtils.setUppercasedBeanProperty("propertyReadonly",
0128:                        new String[] { "42131" }, null, bean_properties, bean,
0129:                        new BeanImpl2());
0130:                assertEquals(bean.getPropertyReadonly(), 23L);
0131:            }
0132:
0133:            public void testSetUppercaseBeanProperty()
0134:                    throws BeanUtilsException, ParseException,
0135:                    SerializationUtilsErrorException {
0136:                BeanImpl2 bean;
0137:                Map<String, PropertyDescriptor> bean_properties = BeanUtils
0138:                        .getUppercasedBeanProperties(BeanImpl2.class);
0139:
0140:                bean = new BeanImpl2();
0141:                BeanUtils.setUppercasedBeanProperty("propertyString",
0142:                        new String[] { "one", "two" }, null, bean_properties,
0143:                        bean, new BeanImpl2());
0144:                assertEquals(bean.getPropertyString(), "one");
0145:
0146:                bean = new BeanImpl2();
0147:                BeanUtils.setUppercasedBeanProperty("propertyInt",
0148:                        new String[] { "438", "two" }, null, bean_properties,
0149:                        bean, new BeanImpl2());
0150:                assertEquals(bean.getPropertyInt(), 438);
0151:
0152:                bean = new BeanImpl2();
0153:                BeanUtils.setUppercasedBeanProperty("propertyChar",
0154:                        new String[] { "E", "two" }, null, bean_properties,
0155:                        bean, new BeanImpl2());
0156:                assertEquals(bean.getPropertyChar(), 'E');
0157:
0158:                bean = new BeanImpl2();
0159:                BeanUtils.setUppercasedBeanProperty("propertyBoolean",
0160:                        new String[] { "true", "two" }, null, bean_properties,
0161:                        bean, new BeanImpl2());
0162:                assertEquals(bean.isPropertyBoolean(), true);
0163:
0164:                bean = new BeanImpl2();
0165:                BeanUtils.setUppercasedBeanProperty("propertyByte",
0166:                        new String[] { "27", "two" }, null, bean_properties,
0167:                        bean, new BeanImpl2());
0168:                assertEquals(bean.getPropertyByte(), 27);
0169:
0170:                bean = new BeanImpl2();
0171:                BeanUtils.setUppercasedBeanProperty("propertyDouble",
0172:                        new String[] { "80756.6287", "two" }, null,
0173:                        bean_properties, bean, new BeanImpl2());
0174:                assertEquals(bean.getPropertyDouble(), 80756.6287d);
0175:
0176:                bean = new BeanImpl2();
0177:                BeanUtils.setUppercasedBeanProperty("propertyFloat",
0178:                        new String[] { "435.557", "two" }, null,
0179:                        bean_properties, bean, new BeanImpl2());
0180:                assertEquals(bean.getPropertyFloat(), 435.557f);
0181:
0182:                bean = new BeanImpl2();
0183:                BeanUtils.setUppercasedBeanProperty("propertyLong",
0184:                        new String[] { "122875", "two" }, null,
0185:                        bean_properties, bean, new BeanImpl2());
0186:                assertEquals(bean.getPropertyLong(), 122875);
0187:
0188:                bean = new BeanImpl2();
0189:                BeanUtils.setUppercasedBeanProperty("propertyShort",
0190:                        new String[] { "3285", "two" }, null, bean_properties,
0191:                        bean, new BeanImpl2());
0192:                assertEquals(bean.getPropertyShort(), 3285);
0193:
0194:                bean = new BeanImpl2();
0195:                BeanUtils.setUppercasedBeanProperty("propertyBigDecimal",
0196:                        new String[] { "983743.343", "two" }, null,
0197:                        bean_properties, bean, new BeanImpl2());
0198:                assertEquals(bean.getPropertyBigDecimal(), new BigDecimal(
0199:                        "983743.343"));
0200:
0201:                bean = new BeanImpl2();
0202:                BeanUtils.setUppercasedBeanProperty("propertyIntegerObject",
0203:                        new String[] { "438", "two" }, null, bean_properties,
0204:                        bean, new BeanImpl2());
0205:                assertEquals(bean.getPropertyIntegerObject(), new Integer(438));
0206:
0207:                bean = new BeanImpl2();
0208:                BeanUtils.setUppercasedBeanProperty("propertyCharacterObject",
0209:                        new String[] { "E", "two" }, null, bean_properties,
0210:                        bean, new BeanImpl2());
0211:                assertEquals(bean.getPropertyCharacterObject(), new Character(
0212:                        'E'));
0213:
0214:                bean = new BeanImpl2();
0215:                BeanUtils.setUppercasedBeanProperty("propertyBooleanObject",
0216:                        new String[] { "true", "two" }, null, bean_properties,
0217:                        bean, new BeanImpl2());
0218:                assertEquals(bean.getPropertyBooleanObject(), new Boolean(true));
0219:
0220:                bean = new BeanImpl2();
0221:                BeanUtils.setUppercasedBeanProperty("propertyByteObject",
0222:                        new String[] { "27", "two" }, null, bean_properties,
0223:                        bean, new BeanImpl2());
0224:                assertEquals(bean.getPropertyByteObject(), new Byte((byte) 27));
0225:
0226:                bean = new BeanImpl2();
0227:                BeanUtils.setUppercasedBeanProperty("propertyDoubleObject",
0228:                        new String[] { "80756.6287", "two" }, null,
0229:                        bean_properties, bean, new BeanImpl2());
0230:                assertEquals(bean.getPropertyDoubleObject(), new Double(
0231:                        80756.6287d));
0232:
0233:                bean = new BeanImpl2();
0234:                BeanUtils.setUppercasedBeanProperty("propertyFloatObject",
0235:                        new String[] { "435.557", "two" }, null,
0236:                        bean_properties, bean, new BeanImpl2());
0237:                assertEquals(bean.getPropertyFloatObject(), new Float(435.557f));
0238:
0239:                bean = new BeanImpl2();
0240:                BeanUtils.setUppercasedBeanProperty("propertyLongObject",
0241:                        new String[] { "122875", "two" }, null,
0242:                        bean_properties, bean, new BeanImpl2());
0243:                assertEquals(bean.getPropertyLongObject(), new Long(122875));
0244:
0245:                bean = new BeanImpl2();
0246:                BeanUtils.setUppercasedBeanProperty("propertyShortObject",
0247:                        new String[] { "3285", "two" }, null, bean_properties,
0248:                        bean, new BeanImpl2());
0249:                assertEquals(bean.getPropertyShortObject(), new Short(
0250:                        (short) 3285));
0251:
0252:                bean = new BeanImpl2();
0253:                BeanUtils.setUppercasedBeanProperty("propertyStringbuffer",
0254:                        new String[] { "one1", "two" }, null, bean_properties,
0255:                        bean, new BeanImpl2());
0256:                assertEquals(bean.getPropertyStringbuffer().toString(), "one1");
0257:
0258:                bean = new BeanImpl2();
0259:                BeanUtils.setUppercasedBeanProperty("propertyStringbuilder",
0260:                        new String[] { "one2", "two" }, null, bean_properties,
0261:                        bean, new BeanImpl2());
0262:                assertEquals(bean.getPropertyStringbuilder().toString(), "one2");
0263:
0264:                bean = new BeanImpl2();
0265:                BeanUtils.setUppercasedBeanProperty("propertyDate",
0266:                        new String[] { "2006-08-04 10:45", "two" }, null,
0267:                        bean_properties, bean, new BeanImpl2());
0268:                assertEquals(bean.getPropertyDate(), RifeConfig.Tools
0269:                        .getDefaultInputDateFormat().parse("2006-08-04 10:45"));
0270:
0271:                bean = new BeanImpl2();
0272:                BeanImpl2.SerializableType serializable = new BeanImpl2.SerializableType(
0273:                        5686, "Testing");
0274:                BeanUtils
0275:                        .setUppercasedBeanProperty(
0276:                                "propertySerializableType",
0277:                                new String[] {
0278:                                        SerializationUtils
0279:                                                .serializeToString(serializable),
0280:                                        "two" }, null, bean_properties, bean,
0281:                                new BeanImpl2());
0282:                assertEquals(bean.getPropertySerializableType(), serializable);
0283:
0284:                bean = new BeanImpl2();
0285:                BeanUtils.setUppercasedBeanProperty("propertyStringArray",
0286:                        new String[] { "one", "two" }, null, bean_properties,
0287:                        bean, new BeanImpl2());
0288:                assertTrue(Arrays.equals(bean.getPropertyStringArray(),
0289:                        new String[] { "one", "two" }));
0290:
0291:                bean = new BeanImpl2();
0292:                BeanUtils.setUppercasedBeanProperty("propertyIntArray",
0293:                        new String[] { "438", "98455", "711" }, null,
0294:                        bean_properties, bean, new BeanImpl2());
0295:                assertTrue(Arrays.equals(bean.getPropertyIntArray(), new int[] {
0296:                        438, 98455, 711 }));
0297:
0298:                bean = new BeanImpl2();
0299:                BeanUtils.setUppercasedBeanProperty("propertyCharArray",
0300:                        new String[] { "E", "a", "x" }, null, bean_properties,
0301:                        bean, new BeanImpl2());
0302:                assertTrue(Arrays.equals(bean.getPropertyCharArray(),
0303:                        new char[] { 'E', 'a', 'x' }));
0304:
0305:                bean = new BeanImpl2();
0306:                BeanUtils.setUppercasedBeanProperty("propertyBooleanArray",
0307:                        new String[] { "true", "0", "t", "1" }, null,
0308:                        bean_properties, bean, new BeanImpl2());
0309:                assertTrue(Arrays.equals(bean.getPropertyBooleanArray(),
0310:                        new boolean[] { true, false, true, true }));
0311:
0312:                bean = new BeanImpl2();
0313:                BeanUtils.setUppercasedBeanProperty("propertyByteArray",
0314:                        new String[] { "27", "78" }, null, bean_properties,
0315:                        bean, new BeanImpl2());
0316:                assertTrue(Arrays.equals(bean.getPropertyByteArray(),
0317:                        new byte[] { 27, 78 }));
0318:
0319:                bean = new BeanImpl2();
0320:                BeanUtils.setUppercasedBeanProperty("propertyDoubleArray",
0321:                        new String[] { "80756.6287", "3214.75", "85796.6237" },
0322:                        null, bean_properties, bean, new BeanImpl2());
0323:                assertTrue(Arrays.equals(bean.getPropertyDoubleArray(),
0324:                        new double[] { 80756.6287d, 3214.75d, 85796.6237d }));
0325:
0326:                bean = new BeanImpl2();
0327:                BeanUtils.setUppercasedBeanProperty("propertyFloatArray",
0328:                        new String[] { "435.557", "589.5" }, null,
0329:                        bean_properties, bean, new BeanImpl2());
0330:                assertTrue(Arrays.equals(bean.getPropertyFloatArray(),
0331:                        new float[] { 435.557f, 589.5f }));
0332:
0333:                bean = new BeanImpl2();
0334:                BeanUtils.setUppercasedBeanProperty("propertyLongArray",
0335:                        new String[] { "122875", "8526780", "3826589" }, null,
0336:                        bean_properties, bean, new BeanImpl2());
0337:                assertTrue(Arrays.equals(bean.getPropertyLongArray(),
0338:                        new long[] { 122875, 8526780, 3826589 }));
0339:
0340:                bean = new BeanImpl2();
0341:                BeanUtils.setUppercasedBeanProperty("propertyShortArray",
0342:                        new String[] { "3285", "58" }, null, bean_properties,
0343:                        bean, new BeanImpl2());
0344:                assertTrue(Arrays.equals(bean.getPropertyShortArray(),
0345:                        new short[] { 3285, 58 }));
0346:
0347:                bean = new BeanImpl2();
0348:                BeanUtils.setUppercasedBeanProperty(
0349:                        "propertyIntegerObjectArray", new String[] { "438",
0350:                                "7865", "475" }, null, bean_properties, bean,
0351:                        new BeanImpl2());
0352:                assertTrue(Arrays.equals(bean.getPropertyIntegerObjectArray(),
0353:                        new Integer[] { 438, 7865, 475 }));
0354:
0355:                bean = new BeanImpl2();
0356:                BeanUtils.setUppercasedBeanProperty(
0357:                        "propertyCharacterObjectArray",
0358:                        new String[] { "E", "z" }, null, bean_properties, bean,
0359:                        new BeanImpl2());
0360:                assertTrue(Arrays.equals(
0361:                        bean.getPropertyCharacterObjectArray(),
0362:                        new Character[] { 'E', 'z' }));
0363:
0364:                bean = new BeanImpl2();
0365:                BeanUtils.setUppercasedBeanProperty(
0366:                        "propertyBooleanObjectArray", new String[] { "fslse",
0367:                                "1", "true" }, null, bean_properties, bean,
0368:                        new BeanImpl2());
0369:                assertTrue(Arrays.equals(bean.getPropertyBooleanObjectArray(),
0370:                        new Boolean[] { false, true, true }));
0371:
0372:                bean = new BeanImpl2();
0373:                BeanUtils.setUppercasedBeanProperty("propertyByteObjectArray",
0374:                        new String[] { "27", "78" }, null, bean_properties,
0375:                        bean, new BeanImpl2());
0376:                assertTrue(Arrays.equals(bean.getPropertyByteObjectArray(),
0377:                        new Byte[] { (byte) 27, (byte) 78 }));
0378:
0379:                bean = new BeanImpl2();
0380:                BeanUtils.setUppercasedBeanProperty(
0381:                        "propertyDoubleObjectArray", new String[] {
0382:                                "80756.6287", "5876.14", "3268.57" }, null,
0383:                        bean_properties, bean, new BeanImpl2());
0384:                assertTrue(Arrays.equals(bean.getPropertyDoubleObjectArray(),
0385:                        new Double[] { 80756.6287d, 5876.14d, 3268.57d }));
0386:
0387:                bean = new BeanImpl2();
0388:                BeanUtils.setUppercasedBeanProperty("propertyFloatObjectArray",
0389:                        new String[] { "435.557", "7865.66" }, null,
0390:                        bean_properties, bean, new BeanImpl2());
0391:                assertTrue(Arrays.equals(bean.getPropertyFloatObjectArray(),
0392:                        new Float[] { 435.557f, 7865.66f }));
0393:
0394:                bean = new BeanImpl2();
0395:                BeanUtils.setUppercasedBeanProperty("propertyLongObjectArray",
0396:                        new String[] { "122875", "5687621", "66578" }, null,
0397:                        bean_properties, bean, new BeanImpl2());
0398:                assertTrue(Arrays.equals(bean.getPropertyLongObjectArray(),
0399:                        new Long[] { 122875L, 5687621L, 66578L }));
0400:
0401:                bean = new BeanImpl2();
0402:                BeanUtils.setUppercasedBeanProperty("propertyShortObjectArray",
0403:                        new String[] { "3285", "6588" }, null, bean_properties,
0404:                        bean, new BeanImpl2());
0405:                assertTrue(Arrays.equals(bean.getPropertyShortObjectArray(),
0406:                        new Short[] { (short) 3285, (short) 6588 }));
0407:
0408:                bean = new BeanImpl2();
0409:                BeanUtils.setUppercasedBeanProperty("propertyBigDecimalArray",
0410:                        new String[] { "32859837434343983.83749837498373434",
0411:                                "65884343.343" }, null, bean_properties, bean,
0412:                        new BeanImpl2());
0413:                assertTrue(Arrays.equals(bean.getPropertyBigDecimalArray(),
0414:                        new BigDecimal[] {
0415:                                new BigDecimal(
0416:                                        "32859837434343983.83749837498373434"),
0417:                                new BigDecimal("65884343343E-3") }));
0418:
0419:                bean = new BeanImpl2();
0420:                BeanUtils.setUppercasedBeanProperty(
0421:                        "propertyStringbufferArray", new String[] { "one1",
0422:                                "two2" }, null, bean_properties, bean,
0423:                        new BeanImpl2());
0424:                assertTrue(Arrays.equals(ArrayUtils.createStringArray(bean
0425:                        .getPropertyStringbufferArray()), new String[] {
0426:                        "one1", "two2" }));
0427:
0428:                bean = new BeanImpl2();
0429:                BeanUtils.setUppercasedBeanProperty(
0430:                        "propertyStringbuilderArray", new String[] { "three3",
0431:                                "four4" }, null, bean_properties, bean,
0432:                        new BeanImpl2());
0433:                assertTrue(Arrays.equals(ArrayUtils.createStringArray(bean
0434:                        .getPropertyStringbuilderArray()), new String[] {
0435:                        "three3", "four4" }));
0436:
0437:                bean = new BeanImpl2();
0438:                BeanUtils
0439:                        .setUppercasedBeanProperty("propertyDateArray",
0440:                                new String[] { "2006-08-04 10:45",
0441:                                        "2006-07-08 11:05" }, null,
0442:                                bean_properties, bean, new BeanImpl2());
0443:                assertTrue(Arrays.equals(bean.getPropertyDateArray(),
0444:                        new Date[] {
0445:                                RifeConfig.Tools.getDefaultInputDateFormat()
0446:                                        .parse("2006-08-04 10:45"),
0447:                                RifeConfig.Tools.getDefaultInputDateFormat()
0448:                                        .parse("2006-07-08 11:05") }));
0449:
0450:                bean = new BeanImpl2();
0451:                BeanImpl2.SerializableType serializable1 = new BeanImpl2.SerializableType(
0452:                        5682, "AnotherTest");
0453:                BeanImpl2.SerializableType serializable2 = new BeanImpl2.SerializableType(
0454:                        850, "WhatTest");
0455:                BeanUtils.setUppercasedBeanProperty(
0456:                        "propertySerializableTypeArray", new String[] {
0457:                                SerializationUtils
0458:                                        .serializeToString(serializable1),
0459:                                SerializationUtils
0460:                                        .serializeToString(serializable2) },
0461:                        null, bean_properties, bean, new BeanImpl2());
0462:                assertTrue(Arrays.equals(bean
0463:                        .getPropertySerializableTypeArray(),
0464:                        new BeanImpl2.SerializableType[] { serializable1,
0465:                                serializable2 }));
0466:            }
0467:
0468:            public void testSetUppercaseBeanPropertyConstrained()
0469:                    throws BeanUtilsException, ParseException,
0470:                    SerializationUtilsErrorException {
0471:                BeanImpl3 bean;
0472:                Map<String, PropertyDescriptor> bean_properties = BeanUtils
0473:                        .getUppercasedBeanProperties(BeanImpl3.class);
0474:
0475:                bean = new BeanImpl3();
0476:                BeanUtils
0477:                        .setUppercasedBeanProperty(
0478:                                "propertyDate",
0479:                                new String[] {
0480:                                        "custom format 2006-08-04 10:45", "two" },
0481:                                null, bean_properties, bean, new BeanImpl3());
0482:                assertEquals(bean.getPropertyDate(), RifeConfig.Tools
0483:                        .getDefaultInputDateFormat().parse("2006-08-04 10:45"));
0484:
0485:                bean = new BeanImpl3();
0486:                BeanUtils.setUppercasedBeanProperty("propertyInt",
0487:                        new String[] { "$438", "two" }, null, bean_properties,
0488:                        bean, new BeanImpl3());
0489:                assertEquals(bean.getPropertyInt(), 438);
0490:
0491:                bean = new BeanImpl3();
0492:                BeanUtils.setUppercasedBeanProperty("propertyByte",
0493:                        new String[] { "2,700%", "two" }, null,
0494:                        bean_properties, bean, new BeanImpl3());
0495:                assertEquals(bean.getPropertyByte(), 27);
0496:
0497:                bean = new BeanImpl3();
0498:                BeanUtils.setUppercasedBeanProperty("propertyDouble",
0499:                        new String[] { "80,756.6287", "two" }, null,
0500:                        bean_properties, bean, new BeanImpl3());
0501:                assertEquals(bean.getPropertyDouble(), 80756.6287d);
0502:
0503:                bean = new BeanImpl3();
0504:                BeanUtils.setUppercasedBeanProperty("propertyFloat",
0505:                        new String[] { "435,557", "two" }, null,
0506:                        bean_properties, bean, new BeanImpl3());
0507:                assertEquals(bean.getPropertyFloat(), 435.557f);
0508:
0509:                bean = new BeanImpl3();
0510:                BeanUtils.setUppercasedBeanProperty("propertyLong",
0511:                        new String[] { "122875 €", "two" }, null,
0512:                        bean_properties, bean, new BeanImpl3());
0513:                assertEquals(bean.getPropertyLong(), 122875);
0514:
0515:                bean = new BeanImpl3();
0516:                BeanUtils.setUppercasedBeanProperty("propertyShort",
0517:                        new String[] { "¤3285", "two" }, null,
0518:                        bean_properties, bean, new BeanImpl3());
0519:                assertEquals(bean.getPropertyShort(), 3285);
0520:
0521:                bean = new BeanImpl3();
0522:                BeanUtils.setUppercasedBeanProperty("propertyBigDecimal",
0523:                        new String[] { "4353344987349830948394893,55709384093",
0524:                                "two" }, null, bean_properties, bean,
0525:                        new BeanImpl3());
0526:                assertEquals(bean.getPropertyBigDecimal(), new BigDecimal(
0527:                        "435334498734983094839489355709384093E-11"));
0528:
0529:                bean = new BeanImpl3();
0530:                BeanUtils.setUppercasedBeanProperty("propertyIntegerObject",
0531:                        new String[] { "$438", "two" }, null, bean_properties,
0532:                        bean, new BeanImpl3());
0533:                assertEquals(bean.getPropertyIntegerObject(), new Integer(438));
0534:
0535:                bean = new BeanImpl3();
0536:                BeanUtils.setUppercasedBeanProperty("propertyByteObject",
0537:                        new String[] { "2,700%", "two" }, null,
0538:                        bean_properties, bean, new BeanImpl3());
0539:                assertEquals(bean.getPropertyByteObject(), new Byte((byte) 27));
0540:
0541:                bean = new BeanImpl3();
0542:                BeanUtils.setUppercasedBeanProperty("propertyDoubleObject",
0543:                        new String[] { "80,756.6287", "two" }, null,
0544:                        bean_properties, bean, new BeanImpl3());
0545:                assertEquals(bean.getPropertyDoubleObject(), new Double(
0546:                        80756.6287d));
0547:
0548:                bean = new BeanImpl3();
0549:                BeanUtils.setUppercasedBeanProperty("propertyFloatObject",
0550:                        new String[] { "435,557", "two" }, null,
0551:                        bean_properties, bean, new BeanImpl3());
0552:                assertEquals(bean.getPropertyFloatObject(), new Float(435.557f));
0553:
0554:                bean = new BeanImpl3();
0555:                BeanUtils.setUppercasedBeanProperty("propertyLongObject",
0556:                        new String[] { "122875 €", "two" }, null,
0557:                        bean_properties, bean, new BeanImpl3());
0558:                assertEquals(bean.getPropertyLongObject(), new Long(122875));
0559:
0560:                bean = new BeanImpl3();
0561:                BeanUtils.setUppercasedBeanProperty("propertyShortObject",
0562:                        new String[] { "¤3285", "two" }, null,
0563:                        bean_properties, bean, new BeanImpl3());
0564:                assertEquals(bean.getPropertyShortObject(), new Short(
0565:                        (short) 3285));
0566:
0567:                bean = new BeanImpl3();
0568:                BeanUtils.setUppercasedBeanProperty("propertyDateArray",
0569:                        new String[] { "custom format 2006-08-04 10:45",
0570:                                "custom format 2006-07-08 11:05" }, null,
0571:                        bean_properties, bean, new BeanImpl3());
0572:                assertTrue(Arrays.equals(bean.getPropertyDateArray(),
0573:                        new Date[] {
0574:                                RifeConfig.Tools.getDefaultInputDateFormat()
0575:                                        .parse("2006-08-04 10:45"),
0576:                                RifeConfig.Tools.getDefaultInputDateFormat()
0577:                                        .parse("2006-07-08 11:05") }));
0578:
0579:                bean = new BeanImpl3();
0580:                BeanUtils.setUppercasedBeanProperty("propertyIntArray",
0581:                        new String[] { "$438", "$98455", "$711" }, null,
0582:                        bean_properties, bean, new BeanImpl3());
0583:                assertTrue(Arrays.equals(bean.getPropertyIntArray(), new int[] {
0584:                        438, 98455, 711 }));
0585:
0586:                bean = new BeanImpl3();
0587:                BeanUtils.setUppercasedBeanProperty("propertyByteArray",
0588:                        new String[] { "2,700%", "7,800%" }, null,
0589:                        bean_properties, bean, new BeanImpl3());
0590:                assertTrue(Arrays.equals(bean.getPropertyByteArray(),
0591:                        new byte[] { 27, 78 }));
0592:
0593:                bean = new BeanImpl3();
0594:                BeanUtils
0595:                        .setUppercasedBeanProperty("propertyDoubleArray",
0596:                                new String[] { "80,756.6287", "3,214.75",
0597:                                        "85,796.6237" }, null, bean_properties,
0598:                                bean, new BeanImpl3());
0599:                assertTrue(Arrays.equals(bean.getPropertyDoubleArray(),
0600:                        new double[] { 80756.6287d, 3214.75d, 85796.6237d }));
0601:
0602:                bean = new BeanImpl3();
0603:                BeanUtils.setUppercasedBeanProperty("propertyFloatArray",
0604:                        new String[] { "435,557", "589,5" }, null,
0605:                        bean_properties, bean, new BeanImpl3());
0606:                assertTrue(Arrays.equals(bean.getPropertyFloatArray(),
0607:                        new float[] { 435.557f, 589.5f }));
0608:
0609:                bean = new BeanImpl3();
0610:                BeanUtils.setUppercasedBeanProperty("propertyLongArray",
0611:                        new String[] { "122875 €", "8526780 €",
0612:                                "3826589 €" }, null, bean_properties, bean,
0613:                        new BeanImpl3());
0614:                assertTrue(Arrays.equals(bean.getPropertyLongArray(),
0615:                        new long[] { 122875, 8526780, 3826589 }));
0616:
0617:                bean = new BeanImpl3();
0618:                BeanUtils.setUppercasedBeanProperty("propertyShortArray",
0619:                        new String[] { "¤3285", "¤58" }, null,
0620:                        bean_properties, bean, new BeanImpl3());
0621:                assertTrue(Arrays.equals(bean.getPropertyShortArray(),
0622:                        new short[] { 3285, 58 }));
0623:
0624:                bean = new BeanImpl3();
0625:                BeanUtils.setUppercasedBeanProperty(
0626:                        "propertyIntegerObjectArray", new String[] { "$438",
0627:                                "$7865", "$475" }, null, bean_properties, bean,
0628:                        new BeanImpl3());
0629:                assertTrue(Arrays.equals(bean.getPropertyIntegerObjectArray(),
0630:                        new Integer[] { 438, 7865, 475 }));
0631:
0632:                bean = new BeanImpl3();
0633:                BeanUtils.setUppercasedBeanProperty("propertyByteObjectArray",
0634:                        new String[] { "2,700%", "7,800%" }, null,
0635:                        bean_properties, bean, new BeanImpl3());
0636:                assertTrue(Arrays.equals(bean.getPropertyByteObjectArray(),
0637:                        new Byte[] { (byte) 27, (byte) 78 }));
0638:
0639:                bean = new BeanImpl3();
0640:                BeanUtils.setUppercasedBeanProperty(
0641:                        "propertyDoubleObjectArray", new String[] {
0642:                                "80,756.6287", "5,876.14", "3,268.57" }, null,
0643:                        bean_properties, bean, new BeanImpl3());
0644:                assertTrue(Arrays.equals(bean.getPropertyDoubleObjectArray(),
0645:                        new Double[] { 80756.6287d, 5876.14d, 3268.57d }));
0646:
0647:                bean = new BeanImpl3();
0648:                BeanUtils.setUppercasedBeanProperty("propertyFloatObjectArray",
0649:                        new String[] { "435,557", "7865,66" }, null,
0650:                        bean_properties, bean, new BeanImpl3());
0651:                assertTrue(Arrays.equals(bean.getPropertyFloatObjectArray(),
0652:                        new Float[] { 435.557f, 7865.66f }));
0653:
0654:                bean = new BeanImpl3();
0655:                BeanUtils
0656:                        .setUppercasedBeanProperty("propertyLongObjectArray",
0657:                                new String[] { "122875 €", "5687621 €",
0658:                                        "66578 €" }, null, bean_properties,
0659:                                bean, new BeanImpl3());
0660:                assertTrue(Arrays.equals(bean.getPropertyLongObjectArray(),
0661:                        new Long[] { 122875L, 5687621L, 66578L }));
0662:
0663:                bean = new BeanImpl3();
0664:                BeanUtils.setUppercasedBeanProperty("propertyShortObjectArray",
0665:                        new String[] { "¤3285", "¤6588" }, null,
0666:                        bean_properties, bean, new BeanImpl3());
0667:                assertTrue(Arrays.equals(bean.getPropertyShortObjectArray(),
0668:                        new Short[] { (short) 3285, (short) 6588 }));
0669:
0670:                bean = new BeanImpl3();
0671:                BeanUtils.setUppercasedBeanProperty("propertyBigDecimalArray",
0672:                        new String[] {
0673:                                "97687687998978673545669789,0000000000001",
0674:                                "34353" }, null, bean_properties, bean,
0675:                        new BeanImpl3());
0676:                assertTrue(Arrays
0677:                        .equals(
0678:                                bean.getPropertyBigDecimalArray(),
0679:                                new BigDecimal[] {
0680:                                        new BigDecimal(
0681:                                                "976876879989786735456697890000000000001E-13"),
0682:                                        new BigDecimal("3.4353E4") }));
0683:            }
0684:
0685:            public void testPropertyNamesIllegal() {
0686:                try {
0687:                    assertEquals(0, BeanUtils.getPropertyNames(null, null,
0688:                            null, null).size());
0689:                } catch (BeanUtilsException e) {
0690:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0691:                }
0692:            }
0693:
0694:            public void testPropertyNamesEmpty() {
0695:                try {
0696:                    assertEquals(0, BeanUtils.getPropertyNames(Object.class,
0697:                            null, null, null).size());
0698:                } catch (BeanUtilsException e) {
0699:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0700:                }
0701:            }
0702:
0703:            public void testPropertyNames() {
0704:                try {
0705:                    Set<String> property_names = BeanUtils.getPropertyNames(
0706:                            BeanImpl.class, null, null, null);
0707:                    assertEquals(property_names.size(), 16);
0708:                    assertTrue(property_names.contains("propertyString"));
0709:                    assertTrue(property_names.contains("propertyStringbuffer"));
0710:                    assertTrue(property_names.contains("propertyDate"));
0711:                    assertTrue(property_names.contains("propertyCalendar"));
0712:                    assertTrue(property_names.contains("propertySqlDate"));
0713:                    assertTrue(property_names.contains("propertyTime"));
0714:                    assertTrue(property_names.contains("propertyTimestamp"));
0715:                    assertTrue(property_names.contains("propertyChar"));
0716:                    assertTrue(property_names.contains("propertyBoolean"));
0717:                    assertTrue(property_names.contains("propertyByte"));
0718:                    assertTrue(property_names.contains("propertyDouble"));
0719:                    assertTrue(property_names.contains("propertyFloat"));
0720:                    assertTrue(property_names.contains("propertyInt"));
0721:                    assertTrue(property_names.contains("propertyLong"));
0722:                    assertTrue(property_names.contains("propertyShort"));
0723:                    assertTrue(property_names.contains("propertyBigDecimal"));
0724:                } catch (BeanUtilsException e) {
0725:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0726:                }
0727:            }
0728:
0729:            public void testPropertyNamesGetters() {
0730:                try {
0731:                    Set<String> property_names = BeanUtils
0732:                            .getPropertyNames(BeanUtils.GETTERS,
0733:                                    BeanImpl.class, null, null, null);
0734:                    assertEquals(property_names.size(), 17);
0735:                    assertTrue(property_names.contains("propertyReadonly"));
0736:                    assertTrue(property_names.contains("propertyString"));
0737:                    assertTrue(property_names.contains("propertyStringbuffer"));
0738:                    assertTrue(property_names.contains("propertyDate"));
0739:                    assertTrue(property_names.contains("propertyCalendar"));
0740:                    assertTrue(property_names.contains("propertySqlDate"));
0741:                    assertTrue(property_names.contains("propertyTime"));
0742:                    assertTrue(property_names.contains("propertyTimestamp"));
0743:                    assertTrue(property_names.contains("propertyChar"));
0744:                    assertTrue(property_names.contains("propertyBoolean"));
0745:                    assertTrue(property_names.contains("propertyByte"));
0746:                    assertTrue(property_names.contains("propertyDouble"));
0747:                    assertTrue(property_names.contains("propertyFloat"));
0748:                    assertTrue(property_names.contains("propertyInt"));
0749:                    assertTrue(property_names.contains("propertyLong"));
0750:                    assertTrue(property_names.contains("propertyShort"));
0751:                    assertTrue(property_names.contains("propertyBigDecimal"));
0752:                } catch (BeanUtilsException e) {
0753:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0754:                }
0755:            }
0756:
0757:            public void testPropertyNamesSetters() {
0758:                try {
0759:                    Set<String> property_names = BeanUtils
0760:                            .getPropertyNames(BeanUtils.SETTERS,
0761:                                    BeanImpl.class, null, null, null);
0762:                    assertEquals(property_names.size(), 17);
0763:                    assertTrue(property_names.contains("propertyWriteonly"));
0764:                    assertTrue(property_names.contains("propertyString"));
0765:                    assertTrue(property_names.contains("propertyStringbuffer"));
0766:                    assertTrue(property_names.contains("propertyDate"));
0767:                    assertTrue(property_names.contains("propertyCalendar"));
0768:                    assertTrue(property_names.contains("propertySqlDate"));
0769:                    assertTrue(property_names.contains("propertyTime"));
0770:                    assertTrue(property_names.contains("propertyTimestamp"));
0771:                    assertTrue(property_names.contains("propertyChar"));
0772:                    assertTrue(property_names.contains("propertyBoolean"));
0773:                    assertTrue(property_names.contains("propertyByte"));
0774:                    assertTrue(property_names.contains("propertyDouble"));
0775:                    assertTrue(property_names.contains("propertyFloat"));
0776:                    assertTrue(property_names.contains("propertyInt"));
0777:                    assertTrue(property_names.contains("propertyLong"));
0778:                    assertTrue(property_names.contains("propertyShort"));
0779:                    assertTrue(property_names.contains("propertyBigDecimal"));
0780:                } catch (BeanUtilsException e) {
0781:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0782:                }
0783:            }
0784:
0785:            public void testPropertyNamesPrefix() {
0786:                try {
0787:                    Set<String> property_names = BeanUtils.getPropertyNames(
0788:                            BeanImpl.class, null, null, "PREFIX:");
0789:                    assertEquals(property_names.size(), 16);
0790:                    assertTrue(property_names.contains("PREFIX:propertyString"));
0791:                    assertTrue(property_names
0792:                            .contains("PREFIX:propertyStringbuffer"));
0793:                    assertTrue(property_names.contains("PREFIX:propertyDate"));
0794:                    assertTrue(property_names
0795:                            .contains("PREFIX:propertyCalendar"));
0796:                    assertTrue(property_names
0797:                            .contains("PREFIX:propertySqlDate"));
0798:                    assertTrue(property_names.contains("PREFIX:propertyTime"));
0799:                    assertTrue(property_names
0800:                            .contains("PREFIX:propertyTimestamp"));
0801:                    assertTrue(property_names.contains("PREFIX:propertyChar"));
0802:                    assertTrue(property_names
0803:                            .contains("PREFIX:propertyBoolean"));
0804:                    assertTrue(property_names.contains("PREFIX:propertyByte"));
0805:                    assertTrue(property_names.contains("PREFIX:propertyDouble"));
0806:                    assertTrue(property_names.contains("PREFIX:propertyFloat"));
0807:                    assertTrue(property_names.contains("PREFIX:propertyInt"));
0808:                    assertTrue(property_names.contains("PREFIX:propertyLong"));
0809:                    assertTrue(property_names.contains("PREFIX:propertyShort"));
0810:                    assertTrue(property_names
0811:                            .contains("PREFIX:propertyBigDecimal"));
0812:                } catch (BeanUtilsException e) {
0813:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0814:                }
0815:            }
0816:
0817:            public void testPropertyNamesPrefixGetters() {
0818:                try {
0819:                    Set<String> property_names = BeanUtils.getPropertyNames(
0820:                            BeanUtils.GETTERS, BeanImpl.class, null, null,
0821:                            "PREFIX:");
0822:                    assertEquals(property_names.size(), 17);
0823:                    assertTrue(property_names
0824:                            .contains("PREFIX:propertyReadonly"));
0825:                    assertTrue(property_names.contains("PREFIX:propertyString"));
0826:                    assertTrue(property_names
0827:                            .contains("PREFIX:propertyStringbuffer"));
0828:                    assertTrue(property_names.contains("PREFIX:propertyDate"));
0829:                    assertTrue(property_names
0830:                            .contains("PREFIX:propertyCalendar"));
0831:                    assertTrue(property_names
0832:                            .contains("PREFIX:propertySqlDate"));
0833:                    assertTrue(property_names.contains("PREFIX:propertyTime"));
0834:                    assertTrue(property_names
0835:                            .contains("PREFIX:propertyTimestamp"));
0836:                    assertTrue(property_names.contains("PREFIX:propertyChar"));
0837:                    assertTrue(property_names
0838:                            .contains("PREFIX:propertyBoolean"));
0839:                    assertTrue(property_names.contains("PREFIX:propertyByte"));
0840:                    assertTrue(property_names.contains("PREFIX:propertyDouble"));
0841:                    assertTrue(property_names.contains("PREFIX:propertyFloat"));
0842:                    assertTrue(property_names.contains("PREFIX:propertyInt"));
0843:                    assertTrue(property_names.contains("PREFIX:propertyLong"));
0844:                    assertTrue(property_names.contains("PREFIX:propertyShort"));
0845:                    assertTrue(property_names
0846:                            .contains("PREFIX:propertyBigDecimal"));
0847:                } catch (BeanUtilsException e) {
0848:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0849:                }
0850:            }
0851:
0852:            public void testPropertyNamesPrefixSetters() {
0853:                try {
0854:                    Set<String> property_names = BeanUtils.getPropertyNames(
0855:                            BeanUtils.SETTERS, BeanImpl.class, null, null,
0856:                            "PREFIX:");
0857:                    assertEquals(property_names.size(), 17);
0858:                    assertTrue(property_names
0859:                            .contains("PREFIX:propertyWriteonly"));
0860:                    assertTrue(property_names.contains("PREFIX:propertyString"));
0861:                    assertTrue(property_names
0862:                            .contains("PREFIX:propertyStringbuffer"));
0863:                    assertTrue(property_names.contains("PREFIX:propertyDate"));
0864:                    assertTrue(property_names
0865:                            .contains("PREFIX:propertyCalendar"));
0866:                    assertTrue(property_names
0867:                            .contains("PREFIX:propertySqlDate"));
0868:                    assertTrue(property_names.contains("PREFIX:propertyTime"));
0869:                    assertTrue(property_names
0870:                            .contains("PREFIX:propertyTimestamp"));
0871:                    assertTrue(property_names.contains("PREFIX:propertyChar"));
0872:                    assertTrue(property_names
0873:                            .contains("PREFIX:propertyBoolean"));
0874:                    assertTrue(property_names.contains("PREFIX:propertyByte"));
0875:                    assertTrue(property_names.contains("PREFIX:propertyDouble"));
0876:                    assertTrue(property_names.contains("PREFIX:propertyFloat"));
0877:                    assertTrue(property_names.contains("PREFIX:propertyInt"));
0878:                    assertTrue(property_names.contains("PREFIX:propertyLong"));
0879:                    assertTrue(property_names.contains("PREFIX:propertyShort"));
0880:                    assertTrue(property_names
0881:                            .contains("PREFIX:propertyBigDecimal"));
0882:                } catch (BeanUtilsException e) {
0883:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0884:                }
0885:            }
0886:
0887:            public void testPropertyNamesIncluded() {
0888:                try {
0889:                    Set<String> property_names = BeanUtils.getPropertyNames(
0890:                            BeanImpl.class, new String[] { "propertyReadonly",
0891:                                    "propertyWriteonly",
0892:                                    "propertyStringbuffer", "propertyCalendar",
0893:                                    "propertySqlDate", "propertyChar",
0894:                                    "propertyByte", "propertyDouble",
0895:                                    "propertyShort" }, null, null);
0896:                    assertEquals(property_names.size(), 7);
0897:                    assertTrue(property_names.contains("propertyStringbuffer"));
0898:                    assertTrue(property_names.contains("propertyCalendar"));
0899:                    assertTrue(property_names.contains("propertySqlDate"));
0900:                    assertTrue(property_names.contains("propertyChar"));
0901:                    assertTrue(property_names.contains("propertyByte"));
0902:                    assertTrue(property_names.contains("propertyDouble"));
0903:                    assertTrue(property_names.contains("propertyShort"));
0904:                } catch (BeanUtilsException e) {
0905:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0906:                }
0907:            }
0908:
0909:            public void testPropertyNamesIncludedGetters() {
0910:                try {
0911:                    Set<String> property_names = BeanUtils.getPropertyNames(
0912:                            BeanUtils.GETTERS, BeanImpl.class, new String[] {
0913:                                    "propertyReadonly", "propertyWriteonly",
0914:                                    "propertyStringbuffer", "propertyCalendar",
0915:                                    "propertySqlDate", "propertyChar",
0916:                                    "propertyByte", "propertyDouble",
0917:                                    "propertyShort" }, null, null);
0918:                    assertEquals(property_names.size(), 8);
0919:                    assertTrue(property_names.contains("propertyReadonly"));
0920:                    assertTrue(property_names.contains("propertyStringbuffer"));
0921:                    assertTrue(property_names.contains("propertyCalendar"));
0922:                    assertTrue(property_names.contains("propertySqlDate"));
0923:                    assertTrue(property_names.contains("propertyChar"));
0924:                    assertTrue(property_names.contains("propertyByte"));
0925:                    assertTrue(property_names.contains("propertyDouble"));
0926:                    assertTrue(property_names.contains("propertyShort"));
0927:                } catch (BeanUtilsException e) {
0928:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0929:                }
0930:            }
0931:
0932:            public void testPropertyNamesIncludedSetters() {
0933:                try {
0934:                    Set<String> property_names = BeanUtils.getPropertyNames(
0935:                            BeanUtils.SETTERS, BeanImpl.class, new String[] {
0936:                                    "propertyReadonly", "propertyWriteonly",
0937:                                    "propertyStringbuffer", "propertyCalendar",
0938:                                    "propertySqlDate", "propertyChar",
0939:                                    "propertyByte", "propertyDouble",
0940:                                    "propertyShort" }, null, null);
0941:                    assertEquals(property_names.size(), 8);
0942:                    assertTrue(property_names.contains("propertyWriteonly"));
0943:                    assertTrue(property_names.contains("propertyStringbuffer"));
0944:                    assertTrue(property_names.contains("propertyCalendar"));
0945:                    assertTrue(property_names.contains("propertySqlDate"));
0946:                    assertTrue(property_names.contains("propertyChar"));
0947:                    assertTrue(property_names.contains("propertyByte"));
0948:                    assertTrue(property_names.contains("propertyDouble"));
0949:                    assertTrue(property_names.contains("propertyShort"));
0950:                } catch (BeanUtilsException e) {
0951:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0952:                }
0953:            }
0954:
0955:            public void testPropertyNamesIncludedPrefix() {
0956:                try {
0957:                    Set<String> property_names = BeanUtils.getPropertyNames(
0958:                            BeanImpl.class, new String[] {
0959:                                    "PREFIX:propertyReadonly",
0960:                                    "PREFIX:propertyWriteonly",
0961:                                    "PREFIX:propertyStringbuffer",
0962:                                    "PREFIX:propertyCalendar",
0963:                                    "PREFIX:propertySqlDate",
0964:                                    "PREFIX:propertyChar",
0965:                                    "PREFIX:propertyByte",
0966:                                    "PREFIX:propertyDouble",
0967:                                    "PREFIX:propertyShort" }, null, "PREFIX:");
0968:                    assertEquals(property_names.size(), 7);
0969:                    assertTrue(property_names
0970:                            .contains("PREFIX:propertyStringbuffer"));
0971:                    assertTrue(property_names
0972:                            .contains("PREFIX:propertyCalendar"));
0973:                    assertTrue(property_names
0974:                            .contains("PREFIX:propertySqlDate"));
0975:                    assertTrue(property_names.contains("PREFIX:propertyChar"));
0976:                    assertTrue(property_names.contains("PREFIX:propertyByte"));
0977:                    assertTrue(property_names.contains("PREFIX:propertyDouble"));
0978:                    assertTrue(property_names.contains("PREFIX:propertyShort"));
0979:                } catch (BeanUtilsException e) {
0980:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0981:                }
0982:            }
0983:
0984:            public void testPropertyNamesIncludedPrefixGetters() {
0985:                try {
0986:                    Set<String> property_names = BeanUtils.getPropertyNames(
0987:                            BeanUtils.GETTERS, BeanImpl.class, new String[] {
0988:                                    "PREFIX:propertyReadonly",
0989:                                    "PREFIX:propertyWriteonly",
0990:                                    "PREFIX:propertyStringbuffer",
0991:                                    "PREFIX:propertyCalendar",
0992:                                    "PREFIX:propertySqlDate",
0993:                                    "PREFIX:propertyChar",
0994:                                    "PREFIX:propertyByte",
0995:                                    "PREFIX:propertyDouble",
0996:                                    "PREFIX:propertyShort" }, null, "PREFIX:");
0997:                    assertEquals(property_names.size(), 8);
0998:                    assertTrue(property_names
0999:                            .contains("PREFIX:propertyReadonly"));
1000:                    assertTrue(property_names
1001:                            .contains("PREFIX:propertyStringbuffer"));
1002:                    assertTrue(property_names
1003:                            .contains("PREFIX:propertyCalendar"));
1004:                    assertTrue(property_names
1005:                            .contains("PREFIX:propertySqlDate"));
1006:                    assertTrue(property_names.contains("PREFIX:propertyChar"));
1007:                    assertTrue(property_names.contains("PREFIX:propertyByte"));
1008:                    assertTrue(property_names.contains("PREFIX:propertyDouble"));
1009:                    assertTrue(property_names.contains("PREFIX:propertyShort"));
1010:                } catch (BeanUtilsException e) {
1011:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1012:                }
1013:            }
1014:
1015:            public void testPropertyNamesIncludedPrefixSetters() {
1016:                try {
1017:                    Set<String> property_names = BeanUtils.getPropertyNames(
1018:                            BeanUtils.SETTERS, BeanImpl.class, new String[] {
1019:                                    "PREFIX:propertyReadonly",
1020:                                    "PREFIX:propertyWriteonly",
1021:                                    "PREFIX:propertyStringbuffer",
1022:                                    "PREFIX:propertyCalendar",
1023:                                    "PREFIX:propertySqlDate",
1024:                                    "PREFIX:propertyChar",
1025:                                    "PREFIX:propertyByte",
1026:                                    "PREFIX:propertyDouble",
1027:                                    "PREFIX:propertyShort" }, null, "PREFIX:");
1028:                    assertEquals(property_names.size(), 8);
1029:                    assertTrue(property_names
1030:                            .contains("PREFIX:propertyWriteonly"));
1031:                    assertTrue(property_names
1032:                            .contains("PREFIX:propertyStringbuffer"));
1033:                    assertTrue(property_names
1034:                            .contains("PREFIX:propertyCalendar"));
1035:                    assertTrue(property_names
1036:                            .contains("PREFIX:propertySqlDate"));
1037:                    assertTrue(property_names.contains("PREFIX:propertyChar"));
1038:                    assertTrue(property_names.contains("PREFIX:propertyByte"));
1039:                    assertTrue(property_names.contains("PREFIX:propertyDouble"));
1040:                    assertTrue(property_names.contains("PREFIX:propertyShort"));
1041:                } catch (BeanUtilsException e) {
1042:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1043:                }
1044:            }
1045:
1046:            public void testPropertyNamesExcluded() {
1047:                try {
1048:                    Set<String> property_names = BeanUtils.getPropertyNames(
1049:                            BeanImpl.class, null, new String[] {
1050:                                    "propertyStringbuffer", "propertyCalendar",
1051:                                    "propertySqlDate", "propertyChar",
1052:                                    "propertyByte", "propertyDouble",
1053:                                    "propertyShort" }, null);
1054:                    assertEquals(property_names.size(), 9);
1055:                    assertTrue(property_names.contains("propertyString"));
1056:                    assertTrue(property_names.contains("propertyDate"));
1057:                    assertTrue(property_names.contains("propertyTime"));
1058:                    assertTrue(property_names.contains("propertyTimestamp"));
1059:                    assertTrue(property_names.contains("propertyBoolean"));
1060:                    assertTrue(property_names.contains("propertyFloat"));
1061:                    assertTrue(property_names.contains("propertyInt"));
1062:                    assertTrue(property_names.contains("propertyLong"));
1063:                    assertTrue(property_names.contains("propertyBigDecimal"));
1064:                } catch (BeanUtilsException e) {
1065:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1066:                }
1067:            }
1068:
1069:            public void testPropertyNamesExcludedGetters() {
1070:                try {
1071:                    Set<String> property_names = BeanUtils.getPropertyNames(
1072:                            BeanUtils.GETTERS, BeanImpl.class, null,
1073:                            new String[] { "propertyStringbuffer",
1074:                                    "propertyCalendar", "propertySqlDate",
1075:                                    "propertyChar", "propertyByte",
1076:                                    "propertyDouble", "propertyShort" }, null);
1077:                    assertEquals(property_names.size(), 10);
1078:                    assertTrue(property_names.contains("propertyReadonly"));
1079:                    assertTrue(property_names.contains("propertyString"));
1080:                    assertTrue(property_names.contains("propertyDate"));
1081:                    assertTrue(property_names.contains("propertyTime"));
1082:                    assertTrue(property_names.contains("propertyTimestamp"));
1083:                    assertTrue(property_names.contains("propertyBoolean"));
1084:                    assertTrue(property_names.contains("propertyFloat"));
1085:                    assertTrue(property_names.contains("propertyInt"));
1086:                    assertTrue(property_names.contains("propertyLong"));
1087:                    assertTrue(property_names.contains("propertyBigDecimal"));
1088:                } catch (BeanUtilsException e) {
1089:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1090:                }
1091:            }
1092:
1093:            public void testPropertyNamesExcludedSetters() {
1094:                try {
1095:                    Set<String> property_names = BeanUtils.getPropertyNames(
1096:                            BeanUtils.SETTERS, BeanImpl.class, null,
1097:                            new String[] { "propertyStringbuffer",
1098:                                    "propertyCalendar", "propertySqlDate",
1099:                                    "propertyChar", "propertyByte",
1100:                                    "propertyDouble", "propertyShort" }, null);
1101:                    assertEquals(property_names.size(), 10);
1102:                    assertTrue(property_names.contains("propertyWriteonly"));
1103:                    assertTrue(property_names.contains("propertyString"));
1104:                    assertTrue(property_names.contains("propertyDate"));
1105:                    assertTrue(property_names.contains("propertyTime"));
1106:                    assertTrue(property_names.contains("propertyTimestamp"));
1107:                    assertTrue(property_names.contains("propertyBoolean"));
1108:                    assertTrue(property_names.contains("propertyFloat"));
1109:                    assertTrue(property_names.contains("propertyInt"));
1110:                    assertTrue(property_names.contains("propertyLong"));
1111:                    assertTrue(property_names.contains("propertyBigDecimal"));
1112:                } catch (BeanUtilsException e) {
1113:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1114:                }
1115:            }
1116:
1117:            public void testPropertyNamesExcludedPrefix() {
1118:                try {
1119:                    Set<String> property_names = BeanUtils.getPropertyNames(
1120:                            BeanImpl.class, null, new String[] {
1121:                                    "PREFIX:propertyStringbuffer",
1122:                                    "PREFIX:propertyCalendar",
1123:                                    "PREFIX:propertySqlDate",
1124:                                    "PREFIX:propertyChar",
1125:                                    "PREFIX:propertyByte",
1126:                                    "PREFIX:propertyDouble",
1127:                                    "PREFIX:propertyShort" }, "PREFIX:");
1128:                    assertEquals(property_names.size(), 9);
1129:                    assertTrue(property_names.contains("PREFIX:propertyString"));
1130:                    assertTrue(property_names.contains("PREFIX:propertyDate"));
1131:                    assertTrue(property_names.contains("PREFIX:propertyTime"));
1132:                    assertTrue(property_names
1133:                            .contains("PREFIX:propertyTimestamp"));
1134:                    assertTrue(property_names
1135:                            .contains("PREFIX:propertyBoolean"));
1136:                    assertTrue(property_names.contains("PREFIX:propertyFloat"));
1137:                    assertTrue(property_names.contains("PREFIX:propertyInt"));
1138:                    assertTrue(property_names.contains("PREFIX:propertyLong"));
1139:                    assertTrue(property_names
1140:                            .contains("PREFIX:propertyBigDecimal"));
1141:                } catch (BeanUtilsException e) {
1142:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1143:                }
1144:            }
1145:
1146:            public void testPropertyNamesExcludedPrefixGetters() {
1147:                try {
1148:                    Set<String> property_names = BeanUtils.getPropertyNames(
1149:                            BeanUtils.GETTERS, BeanImpl.class, null,
1150:                            new String[] { "PREFIX:propertyStringbuffer",
1151:                                    "PREFIX:propertyCalendar",
1152:                                    "PREFIX:propertySqlDate",
1153:                                    "PREFIX:propertyChar",
1154:                                    "PREFIX:propertyByte",
1155:                                    "PREFIX:propertyDouble",
1156:                                    "PREFIX:propertyShort" }, "PREFIX:");
1157:                    assertEquals(property_names.size(), 10);
1158:                    assertTrue(property_names
1159:                            .contains("PREFIX:propertyReadonly"));
1160:                    assertTrue(property_names.contains("PREFIX:propertyString"));
1161:                    assertTrue(property_names.contains("PREFIX:propertyDate"));
1162:                    assertTrue(property_names.contains("PREFIX:propertyTime"));
1163:                    assertTrue(property_names
1164:                            .contains("PREFIX:propertyTimestamp"));
1165:                    assertTrue(property_names
1166:                            .contains("PREFIX:propertyBoolean"));
1167:                    assertTrue(property_names.contains("PREFIX:propertyFloat"));
1168:                    assertTrue(property_names.contains("PREFIX:propertyInt"));
1169:                    assertTrue(property_names.contains("PREFIX:propertyLong"));
1170:                    assertTrue(property_names
1171:                            .contains("PREFIX:propertyBigDecimal"));
1172:                } catch (BeanUtilsException e) {
1173:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1174:                }
1175:            }
1176:
1177:            public void testPropertyNamesExcludedPrefixSetters() {
1178:                try {
1179:                    Set<String> property_names = BeanUtils.getPropertyNames(
1180:                            BeanUtils.SETTERS, BeanImpl.class, null,
1181:                            new String[] { "PREFIX:propertyStringbuffer",
1182:                                    "PREFIX:propertyCalendar",
1183:                                    "PREFIX:propertySqlDate",
1184:                                    "PREFIX:propertyChar",
1185:                                    "PREFIX:propertyByte",
1186:                                    "PREFIX:propertyDouble",
1187:                                    "PREFIX:propertyShort" }, "PREFIX:");
1188:                    assertEquals(property_names.size(), 10);
1189:                    assertTrue(property_names
1190:                            .contains("PREFIX:propertyWriteonly"));
1191:                    assertTrue(property_names.contains("PREFIX:propertyString"));
1192:                    assertTrue(property_names.contains("PREFIX:propertyDate"));
1193:                    assertTrue(property_names.contains("PREFIX:propertyTime"));
1194:                    assertTrue(property_names
1195:                            .contains("PREFIX:propertyTimestamp"));
1196:                    assertTrue(property_names
1197:                            .contains("PREFIX:propertyBoolean"));
1198:                    assertTrue(property_names.contains("PREFIX:propertyFloat"));
1199:                    assertTrue(property_names.contains("PREFIX:propertyInt"));
1200:                    assertTrue(property_names.contains("PREFIX:propertyLong"));
1201:                    assertTrue(property_names
1202:                            .contains("PREFIX:propertyBigDecimal"));
1203:                } catch (BeanUtilsException e) {
1204:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1205:                }
1206:            }
1207:
1208:            public void testPropertyNamesFiltered() {
1209:                try {
1210:                    Set<String> property_names = BeanUtils.getPropertyNames(
1211:                            BeanImpl.class, new String[] { "propertyReadonly",
1212:                                    "propertyWriteonly",
1213:                                    "propertyStringbuffer", "propertyCalendar",
1214:                                    "propertySqlDate", "propertyChar",
1215:                                    "propertyByte", "propertyDouble",
1216:                                    "propertyShort" }, new String[] {
1217:                                    "propertySqlDate", "propertyByte",
1218:                                    "propertyShort" }, null);
1219:                    assertEquals(property_names.size(), 4);
1220:                    assertTrue(property_names.contains("propertyStringbuffer"));
1221:                    assertTrue(property_names.contains("propertyCalendar"));
1222:                    assertTrue(property_names.contains("propertyChar"));
1223:                    assertTrue(property_names.contains("propertyDouble"));
1224:                } catch (BeanUtilsException e) {
1225:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1226:                }
1227:            }
1228:
1229:            public void testPropertyNamesFilteredGetters() {
1230:                try {
1231:                    Set<String> property_names = BeanUtils.getPropertyNames(
1232:                            BeanUtils.GETTERS, BeanImpl.class, new String[] {
1233:                                    "propertyReadonly", "propertyWriteonly",
1234:                                    "propertyStringbuffer", "propertyCalendar",
1235:                                    "propertySqlDate", "propertyChar",
1236:                                    "propertyByte", "propertyDouble",
1237:                                    "propertyShort" }, new String[] {
1238:                                    "propertySqlDate", "propertyByte",
1239:                                    "propertyShort" }, null);
1240:                    assertEquals(property_names.size(), 5);
1241:                    assertTrue(property_names.contains("propertyReadonly"));
1242:                    assertTrue(property_names.contains("propertyStringbuffer"));
1243:                    assertTrue(property_names.contains("propertyCalendar"));
1244:                    assertTrue(property_names.contains("propertyChar"));
1245:                    assertTrue(property_names.contains("propertyDouble"));
1246:                } catch (BeanUtilsException e) {
1247:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1248:                }
1249:            }
1250:
1251:            public void testPropertyNamesFilteredSetters() {
1252:                try {
1253:                    Set<String> property_names = BeanUtils.getPropertyNames(
1254:                            BeanUtils.SETTERS, BeanImpl.class, new String[] {
1255:                                    "propertyReadonly", "propertyWriteonly",
1256:                                    "propertyStringbuffer", "propertyCalendar",
1257:                                    "propertySqlDate", "propertyChar",
1258:                                    "propertyByte", "propertyDouble",
1259:                                    "propertyShort" }, new String[] {
1260:                                    "propertySqlDate", "propertyByte",
1261:                                    "propertyShort" }, null);
1262:                    assertEquals(property_names.size(), 5);
1263:                    assertTrue(property_names.contains("propertyWriteonly"));
1264:                    assertTrue(property_names.contains("propertyStringbuffer"));
1265:                    assertTrue(property_names.contains("propertyCalendar"));
1266:                    assertTrue(property_names.contains("propertyChar"));
1267:                    assertTrue(property_names.contains("propertyDouble"));
1268:                } catch (BeanUtilsException e) {
1269:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1270:                }
1271:            }
1272:
1273:            public void testPropertyNamesFilteredPrefix() {
1274:                try {
1275:                    Set<String> property_names = BeanUtils.getPropertyNames(
1276:                            BeanImpl.class, new String[] {
1277:                                    "PREFIX:propertyReadonly",
1278:                                    "PREFIX:propertyWriteonly",
1279:                                    "PREFIX:propertyStringbuffer",
1280:                                    "PREFIX:propertyCalendar",
1281:                                    "PREFIX:propertySqlDate",
1282:                                    "PREFIX:propertyChar",
1283:                                    "PREFIX:propertyByte",
1284:                                    "PREFIX:propertyDouble",
1285:                                    "PREFIX:propertyShort" }, new String[] {
1286:                                    "PREFIX:propertySqlDate",
1287:                                    "PREFIX:propertyByte",
1288:                                    "PREFIX:propertyShort" }, "PREFIX:");
1289:                    assertEquals(property_names.size(), 4);
1290:                    assertTrue(property_names
1291:                            .contains("PREFIX:propertyStringbuffer"));
1292:                    assertTrue(property_names
1293:                            .contains("PREFIX:propertyCalendar"));
1294:                    assertTrue(property_names.contains("PREFIX:propertyChar"));
1295:                    assertTrue(property_names.contains("PREFIX:propertyDouble"));
1296:                } catch (BeanUtilsException e) {
1297:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1298:                }
1299:            }
1300:
1301:            public void testPropertyNamesFilteredPrefixGetters() {
1302:                try {
1303:                    Set<String> property_names = BeanUtils.getPropertyNames(
1304:                            BeanUtils.GETTERS, BeanImpl.class, new String[] {
1305:                                    "PREFIX:propertyReadonly",
1306:                                    "PREFIX:propertyWriteonly",
1307:                                    "PREFIX:propertyStringbuffer",
1308:                                    "PREFIX:propertyCalendar",
1309:                                    "PREFIX:propertySqlDate",
1310:                                    "PREFIX:propertyChar",
1311:                                    "PREFIX:propertyByte",
1312:                                    "PREFIX:propertyDouble",
1313:                                    "PREFIX:propertyShort" }, new String[] {
1314:                                    "PREFIX:propertySqlDate",
1315:                                    "PREFIX:propertyByte",
1316:                                    "PREFIX:propertyShort" }, "PREFIX:");
1317:                    assertEquals(property_names.size(), 5);
1318:                    assertTrue(property_names
1319:                            .contains("PREFIX:propertyReadonly"));
1320:                    assertTrue(property_names
1321:                            .contains("PREFIX:propertyStringbuffer"));
1322:                    assertTrue(property_names
1323:                            .contains("PREFIX:propertyCalendar"));
1324:                    assertTrue(property_names.contains("PREFIX:propertyChar"));
1325:                    assertTrue(property_names.contains("PREFIX:propertyDouble"));
1326:                } catch (BeanUtilsException e) {
1327:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1328:                }
1329:            }
1330:
1331:            public void testPropertyNamesFilteredPrefixSetters() {
1332:                try {
1333:                    Set<String> property_names = BeanUtils.getPropertyNames(
1334:                            BeanUtils.SETTERS, BeanImpl.class, new String[] {
1335:                                    "PREFIX:propertyReadonly",
1336:                                    "PREFIX:propertyWriteonly",
1337:                                    "PREFIX:propertyStringbuffer",
1338:                                    "PREFIX:propertyCalendar",
1339:                                    "PREFIX:propertySqlDate",
1340:                                    "PREFIX:propertyChar",
1341:                                    "PREFIX:propertyByte",
1342:                                    "PREFIX:propertyDouble",
1343:                                    "PREFIX:propertyShort" }, new String[] {
1344:                                    "PREFIX:propertySqlDate",
1345:                                    "PREFIX:propertyByte",
1346:                                    "PREFIX:propertyShort" }, "PREFIX:");
1347:                    assertEquals(property_names.size(), 5);
1348:                    assertTrue(property_names
1349:                            .contains("PREFIX:propertyWriteonly"));
1350:                    assertTrue(property_names
1351:                            .contains("PREFIX:propertyStringbuffer"));
1352:                    assertTrue(property_names
1353:                            .contains("PREFIX:propertyCalendar"));
1354:                    assertTrue(property_names.contains("PREFIX:propertyChar"));
1355:                    assertTrue(property_names.contains("PREFIX:propertyDouble"));
1356:                } catch (BeanUtilsException e) {
1357:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1358:                }
1359:            }
1360:
1361:            public void testCountPropertiesIllegal() {
1362:                try {
1363:                    assertEquals(0, BeanUtils.countProperties(null, null, null,
1364:                            null));
1365:                } catch (BeanUtilsException e) {
1366:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1367:                }
1368:            }
1369:
1370:            public void testCountProperties() {
1371:                try {
1372:                    int count = BeanUtils.countProperties(BeanImpl.class, null,
1373:                            null, null);
1374:                    assertEquals(count, 16);
1375:                } catch (BeanUtilsException e) {
1376:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1377:                }
1378:            }
1379:
1380:            public void testCountPropertiesGetters() {
1381:                try {
1382:                    int count = BeanUtils.countProperties(BeanUtils.GETTERS,
1383:                            BeanImpl.class, null, null, null);
1384:                    assertEquals(count, 17);
1385:                } catch (BeanUtilsException e) {
1386:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1387:                }
1388:            }
1389:
1390:            public void testCountPropertiesSetters() {
1391:                try {
1392:                    int count = BeanUtils.countProperties(BeanUtils.SETTERS,
1393:                            BeanImpl.class, null, null, null);
1394:                    assertEquals(count, 17);
1395:                } catch (BeanUtilsException e) {
1396:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1397:                }
1398:            }
1399:
1400:            public void testCountPropertiesPrefix() {
1401:                try {
1402:                    int count = BeanUtils.countProperties(BeanImpl.class, null,
1403:                            null, "PREFIX:");
1404:                    assertEquals(count, 16);
1405:                } catch (BeanUtilsException e) {
1406:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1407:                }
1408:            }
1409:
1410:            public void testCountPropertiesPrefixGetters() {
1411:                try {
1412:                    int count = BeanUtils.countProperties(BeanUtils.GETTERS,
1413:                            BeanImpl.class, null, null, "PREFIX:");
1414:                    assertEquals(count, 17);
1415:                } catch (BeanUtilsException e) {
1416:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1417:                }
1418:            }
1419:
1420:            public void testCountPropertiesPrefixSetters() {
1421:                try {
1422:                    int count = BeanUtils.countProperties(BeanUtils.SETTERS,
1423:                            BeanImpl.class, null, null, "PREFIX:");
1424:                    assertEquals(count, 17);
1425:                } catch (BeanUtilsException e) {
1426:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1427:                }
1428:            }
1429:
1430:            public void testCountPropertiesIncluded() {
1431:                try {
1432:                    assertEquals(7, BeanUtils.countProperties(BeanImpl.class,
1433:                            new String[] { "propertyReadonly",
1434:                                    "propertyWriteonly",
1435:                                    "propertyStringbuffer", "propertyCalendar",
1436:                                    "propertySqlDate", "propertyChar",
1437:                                    "propertyByte", "propertyDouble",
1438:                                    "propertyShort" }, null, null));
1439:                } catch (BeanUtilsException e) {
1440:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1441:                }
1442:            }
1443:
1444:            public void testCountPropertiesIncludedGetters() {
1445:                try {
1446:                    assertEquals(8, BeanUtils.countProperties(
1447:                            BeanUtils.GETTERS, BeanImpl.class, new String[] {
1448:                                    "propertyReadonly", "propertyWriteonly",
1449:                                    "propertyStringbuffer", "propertyCalendar",
1450:                                    "propertySqlDate", "propertyChar",
1451:                                    "propertyByte", "propertyDouble",
1452:                                    "propertyShort" }, null, null));
1453:                } catch (BeanUtilsException e) {
1454:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1455:                }
1456:            }
1457:
1458:            public void testCountPropertiesIncludedSetters() {
1459:                try {
1460:                    assertEquals(8, BeanUtils.countProperties(
1461:                            BeanUtils.SETTERS, BeanImpl.class, new String[] {
1462:                                    "propertyReadonly", "propertyWriteonly",
1463:                                    "propertyStringbuffer", "propertyCalendar",
1464:                                    "propertySqlDate", "propertyChar",
1465:                                    "propertyByte", "propertyDouble",
1466:                                    "propertyShort" }, null, null));
1467:                } catch (BeanUtilsException e) {
1468:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1469:                }
1470:            }
1471:
1472:            public void testCountPropertiesIncludedPrefix() {
1473:                try {
1474:                    assertEquals(7, BeanUtils.countProperties(BeanImpl.class,
1475:                            new String[] { "PREFIX:propertyReadonly",
1476:                                    "PREFIX:propertyWriteonly",
1477:                                    "PREFIX:propertyStringbuffer",
1478:                                    "PREFIX:propertyCalendar",
1479:                                    "PREFIX:propertySqlDate",
1480:                                    "PREFIX:propertyChar",
1481:                                    "PREFIX:propertyByte",
1482:                                    "PREFIX:propertyDouble",
1483:                                    "PREFIX:propertyShort" }, null, "PREFIX:"));
1484:                } catch (BeanUtilsException e) {
1485:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1486:                }
1487:            }
1488:
1489:            public void testCountPropertiesIncludedPrefixGetters() {
1490:                try {
1491:                    assertEquals(8, BeanUtils.countProperties(
1492:                            BeanUtils.GETTERS, BeanImpl.class, new String[] {
1493:                                    "PREFIX:propertyReadonly",
1494:                                    "PREFIX:propertyWriteonly",
1495:                                    "PREFIX:propertyStringbuffer",
1496:                                    "PREFIX:propertyCalendar",
1497:                                    "PREFIX:propertySqlDate",
1498:                                    "PREFIX:propertyChar",
1499:                                    "PREFIX:propertyByte",
1500:                                    "PREFIX:propertyDouble",
1501:                                    "PREFIX:propertyShort" }, null, "PREFIX:"));
1502:                } catch (BeanUtilsException e) {
1503:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1504:                }
1505:            }
1506:
1507:            public void testCountPropertiesIncludedPrefixSetters() {
1508:                try {
1509:                    assertEquals(8, BeanUtils.countProperties(
1510:                            BeanUtils.SETTERS, BeanImpl.class, new String[] {
1511:                                    "PREFIX:propertyReadonly",
1512:                                    "PREFIX:propertyWriteonly",
1513:                                    "PREFIX:propertyStringbuffer",
1514:                                    "PREFIX:propertyCalendar",
1515:                                    "PREFIX:propertySqlDate",
1516:                                    "PREFIX:propertyChar",
1517:                                    "PREFIX:propertyByte",
1518:                                    "PREFIX:propertyDouble",
1519:                                    "PREFIX:propertyShort" }, null, "PREFIX:"));
1520:                } catch (BeanUtilsException e) {
1521:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1522:                }
1523:            }
1524:
1525:            public void testCountPropertiesExcluded() {
1526:                try {
1527:                    int count = BeanUtils.countProperties(BeanImpl.class, null,
1528:                            new String[] { "propertyStringbuffer",
1529:                                    "propertyCalendar", "propertySqlDate",
1530:                                    "propertyChar", "propertyByte",
1531:                                    "propertyDouble", "propertyShort" }, null);
1532:                    assertEquals(count, 9);
1533:                } catch (BeanUtilsException e) {
1534:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1535:                }
1536:            }
1537:
1538:            public void testCountPropertiesExcludedGetters() {
1539:                try {
1540:                    int count = BeanUtils.countProperties(BeanUtils.GETTERS,
1541:                            BeanImpl.class, null, new String[] {
1542:                                    "propertyStringbuffer", "propertyCalendar",
1543:                                    "propertySqlDate", "propertyChar",
1544:                                    "propertyByte", "propertyDouble",
1545:                                    "propertyShort" }, null);
1546:                    assertEquals(count, 10);
1547:                } catch (BeanUtilsException e) {
1548:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1549:                }
1550:            }
1551:
1552:            public void testCountPropertiesExcludedSetters() {
1553:                try {
1554:                    int count = BeanUtils.countProperties(BeanUtils.SETTERS,
1555:                            BeanImpl.class, null, new String[] {
1556:                                    "propertyStringbuffer", "propertyCalendar",
1557:                                    "propertySqlDate", "propertyChar",
1558:                                    "propertyByte", "propertyDouble",
1559:                                    "propertyShort" }, null);
1560:                    assertEquals(count, 10);
1561:                } catch (BeanUtilsException e) {
1562:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1563:                }
1564:            }
1565:
1566:            public void testCountPropertiesExcludedPrefix() {
1567:                try {
1568:                    int count = BeanUtils.countProperties(BeanImpl.class, null,
1569:                            new String[] { "PREFIX:propertyStringbuffer",
1570:                                    "PREFIX:propertyCalendar",
1571:                                    "PREFIX:propertySqlDate",
1572:                                    "PREFIX:propertyChar",
1573:                                    "PREFIX:propertyByte",
1574:                                    "PREFIX:propertyDouble",
1575:                                    "PREFIX:propertyShort" }, "PREFIX:");
1576:                    assertEquals(count, 9);
1577:                } catch (BeanUtilsException e) {
1578:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1579:                }
1580:            }
1581:
1582:            public void testCountPropertiesExcludedPrefixGetters() {
1583:                try {
1584:                    int count = BeanUtils.countProperties(BeanUtils.GETTERS,
1585:                            BeanImpl.class, null, new String[] {
1586:                                    "PREFIX:propertyStringbuffer",
1587:                                    "PREFIX:propertyCalendar",
1588:                                    "PREFIX:propertySqlDate",
1589:                                    "PREFIX:propertyChar",
1590:                                    "PREFIX:propertyByte",
1591:                                    "PREFIX:propertyDouble",
1592:                                    "PREFIX:propertyShort" }, "PREFIX:");
1593:                    assertEquals(count, 10);
1594:                } catch (BeanUtilsException e) {
1595:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1596:                }
1597:            }
1598:
1599:            public void testCountPropertiesExcludedPrefixSetters() {
1600:                try {
1601:                    int count = BeanUtils.countProperties(BeanUtils.SETTERS,
1602:                            BeanImpl.class, null, new String[] {
1603:                                    "PREFIX:propertyStringbuffer",
1604:                                    "PREFIX:propertyCalendar",
1605:                                    "PREFIX:propertySqlDate",
1606:                                    "PREFIX:propertyChar",
1607:                                    "PREFIX:propertyByte",
1608:                                    "PREFIX:propertyDouble",
1609:                                    "PREFIX:propertyShort" }, "PREFIX:");
1610:                    assertEquals(count, 10);
1611:                } catch (BeanUtilsException e) {
1612:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1613:                }
1614:            }
1615:
1616:            public void testCountPropertiesFiltered() {
1617:                try {
1618:                    assertEquals(3, BeanUtils.countProperties(BeanImpl.class,
1619:                            new String[] { "propertyReadonly",
1620:                                    "propertyWriteonly",
1621:                                    "propertyStringbuffer", "propertyCalendar",
1622:                                    "propertySqlDate", "propertyChar",
1623:                                    "propertyByte", "propertyDouble",
1624:                                    "propertyShort" }, new String[] {
1625:                                    "propertyStringbuffer", "propertyChar",
1626:                                    "propertyByte", "propertyShort" }, null));
1627:                } catch (BeanUtilsException e) {
1628:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1629:                }
1630:            }
1631:
1632:            public void testCountPropertiesFilteredGetters() {
1633:                try {
1634:                    assertEquals(4, BeanUtils.countProperties(
1635:                            BeanUtils.GETTERS, BeanImpl.class, new String[] {
1636:                                    "propertyReadonly", "propertyWriteonly",
1637:                                    "propertyStringbuffer", "propertyCalendar",
1638:                                    "propertySqlDate", "propertyChar",
1639:                                    "propertyByte", "propertyDouble",
1640:                                    "propertyShort" }, new String[] {
1641:                                    "propertyStringbuffer", "propertyChar",
1642:                                    "propertyByte", "propertyShort" }, null));
1643:                } catch (BeanUtilsException e) {
1644:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1645:                }
1646:            }
1647:
1648:            public void testCountPropertiesFilteredSetters() {
1649:                try {
1650:                    assertEquals(4, BeanUtils.countProperties(
1651:                            BeanUtils.SETTERS, BeanImpl.class, new String[] {
1652:                                    "propertyReadonly", "propertyWriteonly",
1653:                                    "propertyStringbuffer", "propertyCalendar",
1654:                                    "propertySqlDate", "propertyChar",
1655:                                    "propertyByte", "propertyDouble",
1656:                                    "propertyShort" }, new String[] {
1657:                                    "propertyStringbuffer", "propertyChar",
1658:                                    "propertyByte", "propertyShort" }, null));
1659:                } catch (BeanUtilsException e) {
1660:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1661:                }
1662:            }
1663:
1664:            public void testCountPropertiesFilteredPrefix() {
1665:                try {
1666:                    assertEquals(3, BeanUtils.countProperties(BeanImpl.class,
1667:                            new String[] { "PREFIX:propertyReadonly",
1668:                                    "PREFIX:propertyWriteonly",
1669:                                    "PREFIX:propertyStringbuffer",
1670:                                    "PREFIX:propertyCalendar",
1671:                                    "PREFIX:propertySqlDate",
1672:                                    "PREFIX:propertyChar",
1673:                                    "PREFIX:propertyByte",
1674:                                    "PREFIX:propertyDouble",
1675:                                    "PREFIX:propertyShort" }, new String[] {
1676:                                    "PREFIX:propertyStringbuffer",
1677:                                    "PREFIX:propertyChar",
1678:                                    "PREFIX:propertyByte",
1679:                                    "PREFIX:propertyShort" }, "PREFIX:"));
1680:                } catch (BeanUtilsException e) {
1681:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1682:                }
1683:            }
1684:
1685:            public void testCountPropertiesFilteredPrefixGetters() {
1686:                try {
1687:                    assertEquals(4, BeanUtils.countProperties(
1688:                            BeanUtils.GETTERS, BeanImpl.class, new String[] {
1689:                                    "PREFIX:propertyReadonly",
1690:                                    "PREFIX:propertyWriteonly",
1691:                                    "PREFIX:propertyStringbuffer",
1692:                                    "PREFIX:propertyCalendar",
1693:                                    "PREFIX:propertySqlDate",
1694:                                    "PREFIX:propertyChar",
1695:                                    "PREFIX:propertyByte",
1696:                                    "PREFIX:propertyDouble",
1697:                                    "PREFIX:propertyShort" }, new String[] {
1698:                                    "PREFIX:propertyStringbuffer",
1699:                                    "PREFIX:propertyChar",
1700:                                    "PREFIX:propertyByte",
1701:                                    "PREFIX:propertyShort" }, "PREFIX:"));
1702:                } catch (BeanUtilsException e) {
1703:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1704:                }
1705:            }
1706:
1707:            public void testCountPropertiesFilteredPrefixSetters() {
1708:                try {
1709:                    assertEquals(4, BeanUtils.countProperties(
1710:                            BeanUtils.SETTERS, BeanImpl.class, new String[] {
1711:                                    "PREFIX:propertyReadonly",
1712:                                    "PREFIX:propertyWriteonly",
1713:                                    "PREFIX:propertyStringbuffer",
1714:                                    "PREFIX:propertyCalendar",
1715:                                    "PREFIX:propertySqlDate",
1716:                                    "PREFIX:propertyChar",
1717:                                    "PREFIX:propertyByte",
1718:                                    "PREFIX:propertyDouble",
1719:                                    "PREFIX:propertyShort" }, new String[] {
1720:                                    "PREFIX:propertyStringbuffer",
1721:                                    "PREFIX:propertyChar",
1722:                                    "PREFIX:propertyByte",
1723:                                    "PREFIX:propertyShort" }, "PREFIX:"));
1724:                } catch (BeanUtilsException e) {
1725:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1726:                }
1727:            }
1728:
1729:            public void testPropertyTypeIllegal() {
1730:                try {
1731:                    BeanUtils.getPropertyType(null, null);
1732:                    fail();
1733:                } catch (IllegalArgumentException e) {
1734:                    assertTrue(true);
1735:                } catch (BeanUtilsException e) {
1736:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1737:                }
1738:
1739:                try {
1740:                    BeanUtils.getPropertyType(Object.class, null);
1741:                    fail();
1742:                } catch (IllegalArgumentException e) {
1743:                    assertTrue(true);
1744:                } catch (BeanUtilsException e) {
1745:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1746:                }
1747:
1748:                try {
1749:                    BeanUtils.getPropertyType(Object.class, "");
1750:                    fail();
1751:                } catch (IllegalArgumentException e) {
1752:                    assertTrue(true);
1753:                } catch (BeanUtilsException e) {
1754:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1755:                }
1756:            }
1757:
1758:            public void testPropertyType() {
1759:                try {
1760:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1761:                            "propertyString"), String.class);
1762:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1763:                            "propertyStringbuffer"), StringBuffer.class);
1764:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1765:                            "propertyDate"), java.util.Date.class);
1766:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1767:                            "propertyCalendar"), java.util.Calendar.class);
1768:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1769:                            "propertySqlDate"), java.sql.Date.class);
1770:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1771:                            "propertyTime"), java.sql.Time.class);
1772:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1773:                            "propertyTimestamp"), java.sql.Timestamp.class);
1774:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1775:                            "propertyChar"), char.class);
1776:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1777:                            "propertyBoolean"), boolean.class);
1778:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1779:                            "propertyByte"), byte.class);
1780:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1781:                            "propertyDouble"), double.class);
1782:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1783:                            "propertyFloat"), float.class);
1784:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1785:                            "propertyInt"), int.class);
1786:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1787:                            "propertyLong"), long.class);
1788:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1789:                            "propertyShort"), short.class);
1790:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1791:                            "propertyBigDecimal"), BigDecimal.class);
1792:                } catch (BeanUtilsException e) {
1793:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1794:                }
1795:
1796:                try {
1797:                    assertSame(BeanUtils.getPropertyType(BeanImpl.class,
1798:                            "unknown"), String.class);
1799:                    fail();
1800:                } catch (BeanUtilsException e) {
1801:                    assertSame(e.getBeanClass(), BeanImpl.class);
1802:                }
1803:            }
1804:
1805:            public void testPropertyTypesIllegal() {
1806:                try {
1807:                    assertEquals(0, BeanUtils.getPropertyTypes(null, null,
1808:                            null, null).size());
1809:                } catch (BeanUtilsException e) {
1810:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1811:                }
1812:            }
1813:
1814:            public void testPropertyTypes() {
1815:                try {
1816:                    Map<String, Class> property_types = BeanUtils
1817:                            .getPropertyTypes(BeanImpl.class, null, null, null);
1818:                    assertEquals(property_types.size(), 16);
1819:                    assertTrue(property_types.containsKey("propertyString"));
1820:                    assertTrue(property_types
1821:                            .containsKey("propertyStringbuffer"));
1822:                    assertTrue(property_types.containsKey("propertyDate"));
1823:                    assertTrue(property_types.containsKey("propertyCalendar"));
1824:                    assertTrue(property_types.containsKey("propertySqlDate"));
1825:                    assertTrue(property_types.containsKey("propertyTime"));
1826:                    assertTrue(property_types.containsKey("propertyTimestamp"));
1827:                    assertTrue(property_types.containsKey("propertyChar"));
1828:                    assertTrue(property_types.containsKey("propertyBoolean"));
1829:                    assertTrue(property_types.containsKey("propertyByte"));
1830:                    assertTrue(property_types.containsKey("propertyDouble"));
1831:                    assertTrue(property_types.containsKey("propertyFloat"));
1832:                    assertTrue(property_types.containsKey("propertyInt"));
1833:                    assertTrue(property_types.containsKey("propertyLong"));
1834:                    assertTrue(property_types.containsKey("propertyShort"));
1835:                    assertTrue(property_types.containsKey("propertyBigDecimal"));
1836:                    assertSame(property_types.get("propertyString"),
1837:                            String.class);
1838:                    assertSame(property_types.get("propertyStringbuffer"),
1839:                            StringBuffer.class);
1840:                    assertSame(property_types.get("propertyDate"),
1841:                            java.util.Date.class);
1842:                    assertSame(property_types.get("propertyCalendar"),
1843:                            java.util.Calendar.class);
1844:                    assertSame(property_types.get("propertySqlDate"),
1845:                            java.sql.Date.class);
1846:                    assertSame(property_types.get("propertyTime"),
1847:                            java.sql.Time.class);
1848:                    assertSame(property_types.get("propertyTimestamp"),
1849:                            java.sql.Timestamp.class);
1850:                    assertSame(property_types.get("propertyChar"), char.class);
1851:                    assertSame(property_types.get("propertyBoolean"),
1852:                            boolean.class);
1853:                    assertSame(property_types.get("propertyByte"), byte.class);
1854:                    assertSame(property_types.get("propertyDouble"),
1855:                            double.class);
1856:                    assertSame(property_types.get("propertyFloat"), float.class);
1857:                    assertSame(property_types.get("propertyInt"), int.class);
1858:                    assertSame(property_types.get("propertyLong"), long.class);
1859:                    assertSame(property_types.get("propertyShort"), short.class);
1860:                    assertSame(property_types.get("propertyBigDecimal"),
1861:                            BigDecimal.class);
1862:                } catch (BeanUtilsException e) {
1863:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1864:                }
1865:            }
1866:
1867:            public void testPropertyTypesGetters() {
1868:                try {
1869:                    Map<String, Class> property_types = BeanUtils
1870:                            .getPropertyTypes(BeanUtils.GETTERS,
1871:                                    BeanImpl.class, null, null, null);
1872:                    assertEquals(property_types.size(), 17);
1873:                    assertTrue(property_types.containsKey("propertyReadonly"));
1874:                    assertTrue(property_types.containsKey("propertyString"));
1875:                    assertTrue(property_types
1876:                            .containsKey("propertyStringbuffer"));
1877:                    assertTrue(property_types.containsKey("propertyDate"));
1878:                    assertTrue(property_types.containsKey("propertyCalendar"));
1879:                    assertTrue(property_types.containsKey("propertySqlDate"));
1880:                    assertTrue(property_types.containsKey("propertyTime"));
1881:                    assertTrue(property_types.containsKey("propertyTimestamp"));
1882:                    assertTrue(property_types.containsKey("propertyChar"));
1883:                    assertTrue(property_types.containsKey("propertyBoolean"));
1884:                    assertTrue(property_types.containsKey("propertyByte"));
1885:                    assertTrue(property_types.containsKey("propertyDouble"));
1886:                    assertTrue(property_types.containsKey("propertyFloat"));
1887:                    assertTrue(property_types.containsKey("propertyInt"));
1888:                    assertTrue(property_types.containsKey("propertyLong"));
1889:                    assertTrue(property_types.containsKey("propertyShort"));
1890:                    assertTrue(property_types.containsKey("propertyBigDecimal"));
1891:                    assertSame(property_types.get("propertyReadonly"),
1892:                            int.class);
1893:                    assertSame(property_types.get("propertyString"),
1894:                            String.class);
1895:                    assertSame(property_types.get("propertyStringbuffer"),
1896:                            StringBuffer.class);
1897:                    assertSame(property_types.get("propertyDate"),
1898:                            java.util.Date.class);
1899:                    assertSame(property_types.get("propertyCalendar"),
1900:                            java.util.Calendar.class);
1901:                    assertSame(property_types.get("propertySqlDate"),
1902:                            java.sql.Date.class);
1903:                    assertSame(property_types.get("propertyTime"),
1904:                            java.sql.Time.class);
1905:                    assertSame(property_types.get("propertyTimestamp"),
1906:                            java.sql.Timestamp.class);
1907:                    assertSame(property_types.get("propertyChar"), char.class);
1908:                    assertSame(property_types.get("propertyBoolean"),
1909:                            boolean.class);
1910:                    assertSame(property_types.get("propertyByte"), byte.class);
1911:                    assertSame(property_types.get("propertyDouble"),
1912:                            double.class);
1913:                    assertSame(property_types.get("propertyFloat"), float.class);
1914:                    assertSame(property_types.get("propertyInt"), int.class);
1915:                    assertSame(property_types.get("propertyLong"), long.class);
1916:                    assertSame(property_types.get("propertyShort"), short.class);
1917:                    assertSame(property_types.get("propertyBigDecimal"),
1918:                            BigDecimal.class);
1919:                } catch (BeanUtilsException e) {
1920:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1921:                }
1922:            }
1923:
1924:            public void testPropertyTypesSetters() {
1925:                try {
1926:                    Map<String, Class> property_types = BeanUtils
1927:                            .getPropertyTypes(BeanUtils.SETTERS,
1928:                                    BeanImpl.class, null, null, null);
1929:                    assertEquals(property_types.size(), 17);
1930:                    assertTrue(property_types.containsKey("propertyWriteonly"));
1931:                    assertTrue(property_types.containsKey("propertyString"));
1932:                    assertTrue(property_types
1933:                            .containsKey("propertyStringbuffer"));
1934:                    assertTrue(property_types.containsKey("propertyDate"));
1935:                    assertTrue(property_types.containsKey("propertyCalendar"));
1936:                    assertTrue(property_types.containsKey("propertySqlDate"));
1937:                    assertTrue(property_types.containsKey("propertyTime"));
1938:                    assertTrue(property_types.containsKey("propertyTimestamp"));
1939:                    assertTrue(property_types.containsKey("propertyChar"));
1940:                    assertTrue(property_types.containsKey("propertyBoolean"));
1941:                    assertTrue(property_types.containsKey("propertyByte"));
1942:                    assertTrue(property_types.containsKey("propertyDouble"));
1943:                    assertTrue(property_types.containsKey("propertyFloat"));
1944:                    assertTrue(property_types.containsKey("propertyInt"));
1945:                    assertTrue(property_types.containsKey("propertyLong"));
1946:                    assertTrue(property_types.containsKey("propertyShort"));
1947:                    assertTrue(property_types.containsKey("propertyBigDecimal"));
1948:                    assertSame(property_types.get("propertyWriteonly"),
1949:                            long.class);
1950:                    assertSame(property_types.get("propertyString"),
1951:                            String.class);
1952:                    assertSame(property_types.get("propertyStringbuffer"),
1953:                            StringBuffer.class);
1954:                    assertSame(property_types.get("propertyDate"),
1955:                            java.util.Date.class);
1956:                    assertSame(property_types.get("propertyCalendar"),
1957:                            java.util.Calendar.class);
1958:                    assertSame(property_types.get("propertySqlDate"),
1959:                            java.sql.Date.class);
1960:                    assertSame(property_types.get("propertyTime"),
1961:                            java.sql.Time.class);
1962:                    assertSame(property_types.get("propertyTimestamp"),
1963:                            java.sql.Timestamp.class);
1964:                    assertSame(property_types.get("propertyChar"), char.class);
1965:                    assertSame(property_types.get("propertyBoolean"),
1966:                            boolean.class);
1967:                    assertSame(property_types.get("propertyByte"), byte.class);
1968:                    assertSame(property_types.get("propertyDouble"),
1969:                            double.class);
1970:                    assertSame(property_types.get("propertyFloat"), float.class);
1971:                    assertSame(property_types.get("propertyInt"), int.class);
1972:                    assertSame(property_types.get("propertyLong"), long.class);
1973:                    assertSame(property_types.get("propertyShort"), short.class);
1974:                    assertSame(property_types.get("propertyBigDecimal"),
1975:                            BigDecimal.class);
1976:                } catch (BeanUtilsException e) {
1977:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1978:                }
1979:            }
1980:
1981:            public void testPropertyTypesPrefix() {
1982:                try {
1983:                    Map<String, Class> property_types = BeanUtils
1984:                            .getPropertyTypes(BeanImpl.class, null, null,
1985:                                    "PREFIX:");
1986:                    assertEquals(property_types.size(), 16);
1987:                    assertTrue(property_types
1988:                            .containsKey("PREFIX:propertyString"));
1989:                    assertTrue(property_types
1990:                            .containsKey("PREFIX:propertyStringbuffer"));
1991:                    assertTrue(property_types
1992:                            .containsKey("PREFIX:propertyDate"));
1993:                    assertTrue(property_types
1994:                            .containsKey("PREFIX:propertyCalendar"));
1995:                    assertTrue(property_types
1996:                            .containsKey("PREFIX:propertySqlDate"));
1997:                    assertTrue(property_types
1998:                            .containsKey("PREFIX:propertyTime"));
1999:                    assertTrue(property_types
2000:                            .containsKey("PREFIX:propertyTimestamp"));
2001:                    assertTrue(property_types
2002:                            .containsKey("PREFIX:propertyChar"));
2003:                    assertTrue(property_types
2004:                            .containsKey("PREFIX:propertyBoolean"));
2005:                    assertTrue(property_types
2006:                            .containsKey("PREFIX:propertyByte"));
2007:                    assertTrue(property_types
2008:                            .containsKey("PREFIX:propertyDouble"));
2009:                    assertTrue(property_types
2010:                            .containsKey("PREFIX:propertyFloat"));
2011:                    assertTrue(property_types.containsKey("PREFIX:propertyInt"));
2012:                    assertTrue(property_types
2013:                            .containsKey("PREFIX:propertyLong"));
2014:                    assertTrue(property_types
2015:                            .containsKey("PREFIX:propertyShort"));
2016:                    assertTrue(property_types
2017:                            .containsKey("PREFIX:propertyBigDecimal"));
2018:                    assertSame(property_types.get("PREFIX:propertyString"),
2019:                            String.class);
2020:                    assertSame(property_types
2021:                            .get("PREFIX:propertyStringbuffer"),
2022:                            StringBuffer.class);
2023:                    assertSame(property_types.get("PREFIX:propertyDate"),
2024:                            java.util.Date.class);
2025:                    assertSame(property_types.get("PREFIX:propertyCalendar"),
2026:                            java.util.Calendar.class);
2027:                    assertSame(property_types.get("PREFIX:propertySqlDate"),
2028:                            java.sql.Date.class);
2029:                    assertSame(property_types.get("PREFIX:propertyTime"),
2030:                            java.sql.Time.class);
2031:                    assertSame(property_types.get("PREFIX:propertyTimestamp"),
2032:                            java.sql.Timestamp.class);
2033:                    assertSame(property_types.get("PREFIX:propertyChar"),
2034:                            char.class);
2035:                    assertSame(property_types.get("PREFIX:propertyBoolean"),
2036:                            boolean.class);
2037:                    assertSame(property_types.get("PREFIX:propertyByte"),
2038:                            byte.class);
2039:                    assertSame(property_types.get("PREFIX:propertyDouble"),
2040:                            double.class);
2041:                    assertSame(property_types.get("PREFIX:propertyFloat"),
2042:                            float.class);
2043:                    assertSame(property_types.get("PREFIX:propertyInt"),
2044:                            int.class);
2045:                    assertSame(property_types.get("PREFIX:propertyLong"),
2046:                            long.class);
2047:                    assertSame(property_types.get("PREFIX:propertyShort"),
2048:                            short.class);
2049:                    assertSame(property_types.get("PREFIX:propertyBigDecimal"),
2050:                            BigDecimal.class);
2051:                } catch (BeanUtilsException e) {
2052:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2053:                }
2054:            }
2055:
2056:            public void testPropertyTypesPrefixGetters() {
2057:                try {
2058:                    Map<String, Class> property_types = BeanUtils
2059:                            .getPropertyTypes(BeanUtils.GETTERS,
2060:                                    BeanImpl.class, null, null, "PREFIX:");
2061:                    assertEquals(property_types.size(), 17);
2062:                    assertTrue(property_types
2063:                            .containsKey("PREFIX:propertyReadonly"));
2064:                    assertTrue(property_types
2065:                            .containsKey("PREFIX:propertyString"));
2066:                    assertTrue(property_types
2067:                            .containsKey("PREFIX:propertyStringbuffer"));
2068:                    assertTrue(property_types
2069:                            .containsKey("PREFIX:propertyDate"));
2070:                    assertTrue(property_types
2071:                            .containsKey("PREFIX:propertyCalendar"));
2072:                    assertTrue(property_types
2073:                            .containsKey("PREFIX:propertySqlDate"));
2074:                    assertTrue(property_types
2075:                            .containsKey("PREFIX:propertyTime"));
2076:                    assertTrue(property_types
2077:                            .containsKey("PREFIX:propertyTimestamp"));
2078:                    assertTrue(property_types
2079:                            .containsKey("PREFIX:propertyChar"));
2080:                    assertTrue(property_types
2081:                            .containsKey("PREFIX:propertyBoolean"));
2082:                    assertTrue(property_types
2083:                            .containsKey("PREFIX:propertyByte"));
2084:                    assertTrue(property_types
2085:                            .containsKey("PREFIX:propertyDouble"));
2086:                    assertTrue(property_types
2087:                            .containsKey("PREFIX:propertyFloat"));
2088:                    assertTrue(property_types.containsKey("PREFIX:propertyInt"));
2089:                    assertTrue(property_types
2090:                            .containsKey("PREFIX:propertyLong"));
2091:                    assertTrue(property_types
2092:                            .containsKey("PREFIX:propertyShort"));
2093:                    assertTrue(property_types
2094:                            .containsKey("PREFIX:propertyBigDecimal"));
2095:                    assertSame(property_types.get("PREFIX:propertyReadonly"),
2096:                            int.class);
2097:                    assertSame(property_types.get("PREFIX:propertyString"),
2098:                            String.class);
2099:                    assertSame(property_types
2100:                            .get("PREFIX:propertyStringbuffer"),
2101:                            StringBuffer.class);
2102:                    assertSame(property_types.get("PREFIX:propertyDate"),
2103:                            java.util.Date.class);
2104:                    assertSame(property_types.get("PREFIX:propertyCalendar"),
2105:                            java.util.Calendar.class);
2106:                    assertSame(property_types.get("PREFIX:propertySqlDate"),
2107:                            java.sql.Date.class);
2108:                    assertSame(property_types.get("PREFIX:propertyTime"),
2109:                            java.sql.Time.class);
2110:                    assertSame(property_types.get("PREFIX:propertyTimestamp"),
2111:                            java.sql.Timestamp.class);
2112:                    assertSame(property_types.get("PREFIX:propertyChar"),
2113:                            char.class);
2114:                    assertSame(property_types.get("PREFIX:propertyBoolean"),
2115:                            boolean.class);
2116:                    assertSame(property_types.get("PREFIX:propertyByte"),
2117:                            byte.class);
2118:                    assertSame(property_types.get("PREFIX:propertyDouble"),
2119:                            double.class);
2120:                    assertSame(property_types.get("PREFIX:propertyFloat"),
2121:                            float.class);
2122:                    assertSame(property_types.get("PREFIX:propertyInt"),
2123:                            int.class);
2124:                    assertSame(property_types.get("PREFIX:propertyLong"),
2125:                            long.class);
2126:                    assertSame(property_types.get("PREFIX:propertyShort"),
2127:                            short.class);
2128:                    assertSame(property_types.get("PREFIX:propertyBigDecimal"),
2129:                            BigDecimal.class);
2130:                } catch (BeanUtilsException e) {
2131:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2132:                }
2133:            }
2134:
2135:            public void testPropertyTypesPrefixSetters() {
2136:                try {
2137:                    Map<String, Class> property_types = BeanUtils
2138:                            .getPropertyTypes(BeanUtils.SETTERS,
2139:                                    BeanImpl.class, null, null, "PREFIX:");
2140:                    assertEquals(property_types.size(), 17);
2141:                    assertTrue(property_types
2142:                            .containsKey("PREFIX:propertyWriteonly"));
2143:                    assertTrue(property_types
2144:                            .containsKey("PREFIX:propertyString"));
2145:                    assertTrue(property_types
2146:                            .containsKey("PREFIX:propertyStringbuffer"));
2147:                    assertTrue(property_types
2148:                            .containsKey("PREFIX:propertyDate"));
2149:                    assertTrue(property_types
2150:                            .containsKey("PREFIX:propertyCalendar"));
2151:                    assertTrue(property_types
2152:                            .containsKey("PREFIX:propertySqlDate"));
2153:                    assertTrue(property_types
2154:                            .containsKey("PREFIX:propertyTime"));
2155:                    assertTrue(property_types
2156:                            .containsKey("PREFIX:propertyTimestamp"));
2157:                    assertTrue(property_types
2158:                            .containsKey("PREFIX:propertyChar"));
2159:                    assertTrue(property_types
2160:                            .containsKey("PREFIX:propertyBoolean"));
2161:                    assertTrue(property_types
2162:                            .containsKey("PREFIX:propertyByte"));
2163:                    assertTrue(property_types
2164:                            .containsKey("PREFIX:propertyDouble"));
2165:                    assertTrue(property_types
2166:                            .containsKey("PREFIX:propertyFloat"));
2167:                    assertTrue(property_types.containsKey("PREFIX:propertyInt"));
2168:                    assertTrue(property_types
2169:                            .containsKey("PREFIX:propertyLong"));
2170:                    assertTrue(property_types
2171:                            .containsKey("PREFIX:propertyShort"));
2172:                    assertTrue(property_types
2173:                            .containsKey("PREFIX:propertyBigDecimal"));
2174:                    assertSame(property_types.get("PREFIX:propertyWriteonly"),
2175:                            long.class);
2176:                    assertSame(property_types.get("PREFIX:propertyString"),
2177:                            String.class);
2178:                    assertSame(property_types
2179:                            .get("PREFIX:propertyStringbuffer"),
2180:                            StringBuffer.class);
2181:                    assertSame(property_types.get("PREFIX:propertyDate"),
2182:                            java.util.Date.class);
2183:                    assertSame(property_types.get("PREFIX:propertyCalendar"),
2184:                            java.util.Calendar.class);
2185:                    assertSame(property_types.get("PREFIX:propertySqlDate"),
2186:                            java.sql.Date.class);
2187:                    assertSame(property_types.get("PREFIX:propertyTime"),
2188:                            java.sql.Time.class);
2189:                    assertSame(property_types.get("PREFIX:propertyTimestamp"),
2190:                            java.sql.Timestamp.class);
2191:                    assertSame(property_types.get("PREFIX:propertyChar"),
2192:                            char.class);
2193:                    assertSame(property_types.get("PREFIX:propertyBoolean"),
2194:                            boolean.class);
2195:                    assertSame(property_types.get("PREFIX:propertyByte"),
2196:                            byte.class);
2197:                    assertSame(property_types.get("PREFIX:propertyDouble"),
2198:                            double.class);
2199:                    assertSame(property_types.get("PREFIX:propertyFloat"),
2200:                            float.class);
2201:                    assertSame(property_types.get("PREFIX:propertyInt"),
2202:                            int.class);
2203:                    assertSame(property_types.get("PREFIX:propertyLong"),
2204:                            long.class);
2205:                    assertSame(property_types.get("PREFIX:propertyShort"),
2206:                            short.class);
2207:                    assertSame(property_types.get("PREFIX:propertyBigDecimal"),
2208:                            BigDecimal.class);
2209:                } catch (BeanUtilsException e) {
2210:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2211:                }
2212:            }
2213:
2214:            public void testPropertyTypesIncluded() {
2215:                try {
2216:                    Map<String, Class> property_types = BeanUtils
2217:                            .getPropertyTypes(BeanImpl.class, new String[] {
2218:                                    "propertyReadonly", "propertyWriteonly",
2219:                                    "propertyString", "propertyDate",
2220:                                    "propertySqlDate", "propertyTime",
2221:                                    "propertyByte", "propertyFloat",
2222:                                    "propertyShort" }, null, null);
2223:                    assertEquals(property_types.size(), 7);
2224:                    assertTrue(property_types.containsKey("propertyString"));
2225:                    assertTrue(property_types.containsKey("propertyDate"));
2226:                    assertTrue(property_types.containsKey("propertySqlDate"));
2227:                    assertTrue(property_types.containsKey("propertyTime"));
2228:                    assertTrue(property_types.containsKey("propertyByte"));
2229:                    assertTrue(property_types.containsKey("propertyFloat"));
2230:                    assertTrue(property_types.containsKey("propertyShort"));
2231:                    assertSame(property_types.get("propertyString"),
2232:                            String.class);
2233:                    assertSame(property_types.get("propertyDate"),
2234:                            java.util.Date.class);
2235:                    assertSame(property_types.get("propertySqlDate"),
2236:                            java.sql.Date.class);
2237:                    assertSame(property_types.get("propertyTime"),
2238:                            java.sql.Time.class);
2239:                    assertSame(property_types.get("propertyByte"), byte.class);
2240:                    assertSame(property_types.get("propertyFloat"), float.class);
2241:                    assertSame(property_types.get("propertyShort"), short.class);
2242:                } catch (BeanUtilsException e) {
2243:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2244:                }
2245:            }
2246:
2247:            public void testPropertyTypesIncludedGetters() {
2248:                try {
2249:                    Map<String, Class> property_types = BeanUtils
2250:                            .getPropertyTypes(BeanUtils.GETTERS,
2251:                                    BeanImpl.class, new String[] {
2252:                                            "propertyReadonly",
2253:                                            "propertyWriteonly",
2254:                                            "propertyString", "propertyDate",
2255:                                            "propertySqlDate", "propertyTime",
2256:                                            "propertyByte", "propertyFloat",
2257:                                            "propertyShort" }, null, null);
2258:                    assertEquals(property_types.size(), 8);
2259:                    assertTrue(property_types.containsKey("propertyReadonly"));
2260:                    assertTrue(property_types.containsKey("propertyString"));
2261:                    assertTrue(property_types.containsKey("propertyDate"));
2262:                    assertTrue(property_types.containsKey("propertySqlDate"));
2263:                    assertTrue(property_types.containsKey("propertyTime"));
2264:                    assertTrue(property_types.containsKey("propertyByte"));
2265:                    assertTrue(property_types.containsKey("propertyFloat"));
2266:                    assertTrue(property_types.containsKey("propertyShort"));
2267:                    assertSame(property_types.get("propertyReadonly"),
2268:                            int.class);
2269:                    assertSame(property_types.get("propertyString"),
2270:                            String.class);
2271:                    assertSame(property_types.get("propertyDate"),
2272:                            java.util.Date.class);
2273:                    assertSame(property_types.get("propertySqlDate"),
2274:                            java.sql.Date.class);
2275:                    assertSame(property_types.get("propertyTime"),
2276:                            java.sql.Time.class);
2277:                    assertSame(property_types.get("propertyByte"), byte.class);
2278:                    assertSame(property_types.get("propertyFloat"), float.class);
2279:                    assertSame(property_types.get("propertyShort"), short.class);
2280:                } catch (BeanUtilsException e) {
2281:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2282:                }
2283:            }
2284:
2285:            public void testPropertyTypesIncludedSetters() {
2286:                try {
2287:                    Map<String, Class> property_types = BeanUtils
2288:                            .getPropertyTypes(BeanUtils.SETTERS,
2289:                                    BeanImpl.class, new String[] {
2290:                                            "propertyReadonly",
2291:                                            "propertyWriteonly",
2292:                                            "propertyString", "propertyDate",
2293:                                            "propertySqlDate", "propertyTime",
2294:                                            "propertyByte", "propertyFloat",
2295:                                            "propertyShort" }, null, null);
2296:                    assertEquals(property_types.size(), 8);
2297:                    assertTrue(property_types.containsKey("propertyWriteonly"));
2298:                    assertTrue(property_types.containsKey("propertyString"));
2299:                    assertTrue(property_types.containsKey("propertyDate"));
2300:                    assertTrue(property_types.containsKey("propertySqlDate"));
2301:                    assertTrue(property_types.containsKey("propertyTime"));
2302:                    assertTrue(property_types.containsKey("propertyByte"));
2303:                    assertTrue(property_types.containsKey("propertyFloat"));
2304:                    assertTrue(property_types.containsKey("propertyShort"));
2305:                    assertSame(property_types.get("propertyWriteonly"),
2306:                            long.class);
2307:                    assertSame(property_types.get("propertyString"),
2308:                            String.class);
2309:                    assertSame(property_types.get("propertyDate"),
2310:                            java.util.Date.class);
2311:                    assertSame(property_types.get("propertySqlDate"),
2312:                            java.sql.Date.class);
2313:                    assertSame(property_types.get("propertyTime"),
2314:                            java.sql.Time.class);
2315:                    assertSame(property_types.get("propertyByte"), byte.class);
2316:                    assertSame(property_types.get("propertyFloat"), float.class);
2317:                    assertSame(property_types.get("propertyShort"), short.class);
2318:                } catch (BeanUtilsException e) {
2319:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2320:                }
2321:            }
2322:
2323:            public void testPropertyTypesIncludedPrefix() {
2324:                try {
2325:                    Map<String, Class> property_types = BeanUtils
2326:                            .getPropertyTypes(BeanImpl.class, new String[] {
2327:                                    "PREFIX:propertyReadonly",
2328:                                    "PREFIX:propertyWriteonly",
2329:                                    "PREFIX:propertyString",
2330:                                    "PREFIX:propertyDate",
2331:                                    "PREFIX:propertySqlDate",
2332:                                    "PREFIX:propertyTime",
2333:                                    "PREFIX:propertyByte",
2334:                                    "PREFIX:propertyFloat",
2335:                                    "PREFIX:propertyShort" }, null, "PREFIX:");
2336:                    assertEquals(property_types.size(), 7);
2337:                    assertTrue(property_types
2338:                            .containsKey("PREFIX:propertyString"));
2339:                    assertTrue(property_types
2340:                            .containsKey("PREFIX:propertyDate"));
2341:                    assertTrue(property_types
2342:                            .containsKey("PREFIX:propertySqlDate"));
2343:                    assertTrue(property_types
2344:                            .containsKey("PREFIX:propertyTime"));
2345:                    assertTrue(property_types
2346:                            .containsKey("PREFIX:propertyByte"));
2347:                    assertTrue(property_types
2348:                            .containsKey("PREFIX:propertyFloat"));
2349:                    assertTrue(property_types
2350:                            .containsKey("PREFIX:propertyShort"));
2351:                    assertSame(property_types.get("PREFIX:propertyString"),
2352:                            String.class);
2353:                    assertSame(property_types.get("PREFIX:propertyDate"),
2354:                            java.util.Date.class);
2355:                    assertSame(property_types.get("PREFIX:propertySqlDate"),
2356:                            java.sql.Date.class);
2357:                    assertSame(property_types.get("PREFIX:propertyTime"),
2358:                            java.sql.Time.class);
2359:                    assertSame(property_types.get("PREFIX:propertyByte"),
2360:                            byte.class);
2361:                    assertSame(property_types.get("PREFIX:propertyFloat"),
2362:                            float.class);
2363:                    assertSame(property_types.get("PREFIX:propertyShort"),
2364:                            short.class);
2365:                } catch (BeanUtilsException e) {
2366:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2367:                }
2368:            }
2369:
2370:            public void testPropertyTypesIncludedPrefixGetters() {
2371:                try {
2372:                    Map<String, Class> property_types = BeanUtils
2373:                            .getPropertyTypes(BeanUtils.GETTERS,
2374:                                    BeanImpl.class, new String[] {
2375:                                            "PREFIX:propertyReadonly",
2376:                                            "PREFIX:propertyWriteonly",
2377:                                            "PREFIX:propertyString",
2378:                                            "PREFIX:propertyDate",
2379:                                            "PREFIX:propertySqlDate",
2380:                                            "PREFIX:propertyTime",
2381:                                            "PREFIX:propertyByte",
2382:                                            "PREFIX:propertyFloat",
2383:                                            "PREFIX:propertyShort" }, null,
2384:                                    "PREFIX:");
2385:                    assertEquals(property_types.size(), 8);
2386:                    assertTrue(property_types
2387:                            .containsKey("PREFIX:propertyReadonly"));
2388:                    assertTrue(property_types
2389:                            .containsKey("PREFIX:propertyString"));
2390:                    assertTrue(property_types
2391:                            .containsKey("PREFIX:propertyDate"));
2392:                    assertTrue(property_types
2393:                            .containsKey("PREFIX:propertySqlDate"));
2394:                    assertTrue(property_types
2395:                            .containsKey("PREFIX:propertyTime"));
2396:                    assertTrue(property_types
2397:                            .containsKey("PREFIX:propertyByte"));
2398:                    assertTrue(property_types
2399:                            .containsKey("PREFIX:propertyFloat"));
2400:                    assertTrue(property_types
2401:                            .containsKey("PREFIX:propertyShort"));
2402:                    assertSame(property_types.get("PREFIX:propertyReadonly"),
2403:                            int.class);
2404:                    assertSame(property_types.get("PREFIX:propertyString"),
2405:                            String.class);
2406:                    assertSame(property_types.get("PREFIX:propertyDate"),
2407:                            java.util.Date.class);
2408:                    assertSame(property_types.get("PREFIX:propertySqlDate"),
2409:                            java.sql.Date.class);
2410:                    assertSame(property_types.get("PREFIX:propertyTime"),
2411:                            java.sql.Time.class);
2412:                    assertSame(property_types.get("PREFIX:propertyByte"),
2413:                            byte.class);
2414:                    assertSame(property_types.get("PREFIX:propertyFloat"),
2415:                            float.class);
2416:                    assertSame(property_types.get("PREFIX:propertyShort"),
2417:                            short.class);
2418:                } catch (BeanUtilsException e) {
2419:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2420:                }
2421:            }
2422:
2423:            public void testPropertyTypesIncludedPrefixSetters() {
2424:                try {
2425:                    Map<String, Class> property_types = BeanUtils
2426:                            .getPropertyTypes(BeanUtils.SETTERS,
2427:                                    BeanImpl.class, new String[] {
2428:                                            "PREFIX:propertyReadonly",
2429:                                            "PREFIX:propertyWriteonly",
2430:                                            "PREFIX:propertyString",
2431:                                            "PREFIX:propertyDate",
2432:                                            "PREFIX:propertySqlDate",
2433:                                            "PREFIX:propertyTime",
2434:                                            "PREFIX:propertyByte",
2435:                                            "PREFIX:propertyFloat",
2436:                                            "PREFIX:propertyShort" }, null,
2437:                                    "PREFIX:");
2438:                    assertEquals(property_types.size(), 8);
2439:                    assertTrue(property_types
2440:                            .containsKey("PREFIX:propertyWriteonly"));
2441:                    assertTrue(property_types
2442:                            .containsKey("PREFIX:propertyString"));
2443:                    assertTrue(property_types
2444:                            .containsKey("PREFIX:propertyDate"));
2445:                    assertTrue(property_types
2446:                            .containsKey("PREFIX:propertySqlDate"));
2447:                    assertTrue(property_types
2448:                            .containsKey("PREFIX:propertyTime"));
2449:                    assertTrue(property_types
2450:                            .containsKey("PREFIX:propertyByte"));
2451:                    assertTrue(property_types
2452:                            .containsKey("PREFIX:propertyFloat"));
2453:                    assertTrue(property_types
2454:                            .containsKey("PREFIX:propertyShort"));
2455:                    assertSame(property_types.get("PREFIX:propertyWriteonly"),
2456:                            long.class);
2457:                    assertSame(property_types.get("PREFIX:propertyString"),
2458:                            String.class);
2459:                    assertSame(property_types.get("PREFIX:propertyDate"),
2460:                            java.util.Date.class);
2461:                    assertSame(property_types.get("PREFIX:propertySqlDate"),
2462:                            java.sql.Date.class);
2463:                    assertSame(property_types.get("PREFIX:propertyTime"),
2464:                            java.sql.Time.class);
2465:                    assertSame(property_types.get("PREFIX:propertyByte"),
2466:                            byte.class);
2467:                    assertSame(property_types.get("PREFIX:propertyFloat"),
2468:                            float.class);
2469:                    assertSame(property_types.get("PREFIX:propertyShort"),
2470:                            short.class);
2471:                } catch (BeanUtilsException e) {
2472:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2473:                }
2474:            }
2475:
2476:            public void testPropertyTypesExcluded() {
2477:                try {
2478:                    Map<String, Class> property_types = BeanUtils
2479:                            .getPropertyTypes(BeanImpl.class, null,
2480:                                    new String[] { "propertyString",
2481:                                            "propertyCalendar",
2482:                                            "propertySqlDate",
2483:                                            "propertyBoolean", "propertyFloat",
2484:                                            "propertyBigDecimal" }, null);
2485:                    assertEquals(property_types.size(), 10);
2486:                    assertTrue(property_types
2487:                            .containsKey("propertyStringbuffer"));
2488:                    assertTrue(property_types.containsKey("propertyDate"));
2489:                    assertTrue(property_types.containsKey("propertyTime"));
2490:                    assertTrue(property_types.containsKey("propertyTimestamp"));
2491:                    assertTrue(property_types.containsKey("propertyChar"));
2492:                    assertTrue(property_types.containsKey("propertyByte"));
2493:                    assertTrue(property_types.containsKey("propertyDouble"));
2494:                    assertTrue(property_types.containsKey("propertyInt"));
2495:                    assertTrue(property_types.containsKey("propertyLong"));
2496:                    assertTrue(property_types.containsKey("propertyShort"));
2497:                    assertSame(property_types.get("propertyStringbuffer"),
2498:                            StringBuffer.class);
2499:                    assertSame(property_types.get("propertyDate"),
2500:                            java.util.Date.class);
2501:                    assertSame(property_types.get("propertyTime"),
2502:                            java.sql.Time.class);
2503:                    assertSame(property_types.get("propertyTimestamp"),
2504:                            java.sql.Timestamp.class);
2505:                    assertSame(property_types.get("propertyChar"), char.class);
2506:                    assertSame(property_types.get("propertyByte"), byte.class);
2507:                    assertSame(property_types.get("propertyDouble"),
2508:                            double.class);
2509:                    assertSame(property_types.get("propertyInt"), int.class);
2510:                    assertSame(property_types.get("propertyLong"), long.class);
2511:                    assertSame(property_types.get("propertyShort"), short.class);
2512:                } catch (BeanUtilsException e) {
2513:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2514:                }
2515:            }
2516:
2517:            public void testPropertyTypesExcludedGetters() {
2518:                try {
2519:                    Map<String, Class> property_types = BeanUtils
2520:                            .getPropertyTypes(BeanUtils.GETTERS,
2521:                                    BeanImpl.class, null, new String[] {
2522:                                            "propertyString",
2523:                                            "propertyCalendar",
2524:                                            "propertySqlDate",
2525:                                            "propertyBoolean", "propertyFloat",
2526:                                            "propertyBigDecimal" }, null);
2527:                    assertEquals(property_types.size(), 11);
2528:                    assertTrue(property_types.containsKey("propertyReadonly"));
2529:                    assertTrue(property_types
2530:                            .containsKey("propertyStringbuffer"));
2531:                    assertTrue(property_types.containsKey("propertyDate"));
2532:                    assertTrue(property_types.containsKey("propertyTime"));
2533:                    assertTrue(property_types.containsKey("propertyTimestamp"));
2534:                    assertTrue(property_types.containsKey("propertyChar"));
2535:                    assertTrue(property_types.containsKey("propertyByte"));
2536:                    assertTrue(property_types.containsKey("propertyDouble"));
2537:                    assertTrue(property_types.containsKey("propertyInt"));
2538:                    assertTrue(property_types.containsKey("propertyLong"));
2539:                    assertTrue(property_types.containsKey("propertyShort"));
2540:                    assertSame(property_types.get("propertyReadonly"),
2541:                            int.class);
2542:                    assertSame(property_types.get("propertyStringbuffer"),
2543:                            StringBuffer.class);
2544:                    assertSame(property_types.get("propertyDate"),
2545:                            java.util.Date.class);
2546:                    assertSame(property_types.get("propertyTime"),
2547:                            java.sql.Time.class);
2548:                    assertSame(property_types.get("propertyTimestamp"),
2549:                            java.sql.Timestamp.class);
2550:                    assertSame(property_types.get("propertyChar"), char.class);
2551:                    assertSame(property_types.get("propertyByte"), byte.class);
2552:                    assertSame(property_types.get("propertyDouble"),
2553:                            double.class);
2554:                    assertSame(property_types.get("propertyInt"), int.class);
2555:                    assertSame(property_types.get("propertyLong"), long.class);
2556:                    assertSame(property_types.get("propertyShort"), short.class);
2557:                } catch (BeanUtilsException e) {
2558:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2559:                }
2560:            }
2561:
2562:            public void testPropertyTypesExcludedSetters() {
2563:                try {
2564:                    Map<String, Class> property_types = BeanUtils
2565:                            .getPropertyTypes(BeanUtils.SETTERS,
2566:                                    BeanImpl.class, null, new String[] {
2567:                                            "propertyString",
2568:                                            "propertyCalendar",
2569:                                            "propertySqlDate",
2570:                                            "propertyBoolean", "propertyFloat",
2571:                                            "propertyBigDecimal" }, null);
2572:                    assertEquals(property_types.size(), 11);
2573:                    assertTrue(property_types.containsKey("propertyWriteonly"));
2574:                    assertTrue(property_types
2575:                            .containsKey("propertyStringbuffer"));
2576:                    assertTrue(property_types.containsKey("propertyDate"));
2577:                    assertTrue(property_types.containsKey("propertyTime"));
2578:                    assertTrue(property_types.containsKey("propertyTimestamp"));
2579:                    assertTrue(property_types.containsKey("propertyChar"));
2580:                    assertTrue(property_types.containsKey("propertyByte"));
2581:                    assertTrue(property_types.containsKey("propertyDouble"));
2582:                    assertTrue(property_types.containsKey("propertyInt"));
2583:                    assertTrue(property_types.containsKey("propertyLong"));
2584:                    assertTrue(property_types.containsKey("propertyShort"));
2585:                    assertSame(property_types.get("propertyWriteonly"),
2586:                            long.class);
2587:                    assertSame(property_types.get("propertyStringbuffer"),
2588:                            StringBuffer.class);
2589:                    assertSame(property_types.get("propertyDate"),
2590:                            java.util.Date.class);
2591:                    assertSame(property_types.get("propertyTime"),
2592:                            java.sql.Time.class);
2593:                    assertSame(property_types.get("propertyTimestamp"),
2594:                            java.sql.Timestamp.class);
2595:                    assertSame(property_types.get("propertyChar"), char.class);
2596:                    assertSame(property_types.get("propertyByte"), byte.class);
2597:                    assertSame(property_types.get("propertyDouble"),
2598:                            double.class);
2599:                    assertSame(property_types.get("propertyInt"), int.class);
2600:                    assertSame(property_types.get("propertyLong"), long.class);
2601:                    assertSame(property_types.get("propertyShort"), short.class);
2602:                } catch (BeanUtilsException e) {
2603:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2604:                }
2605:            }
2606:
2607:            public void testPropertyTypesExcludedPrefix() {
2608:                try {
2609:                    Map<String, Class> property_types = BeanUtils
2610:                            .getPropertyTypes(BeanImpl.class, null,
2611:                                    new String[] { "PREFIX:propertyString",
2612:                                            "PREFIX:propertyCalendar",
2613:                                            "PREFIX:propertySqlDate",
2614:                                            "PREFIX:propertyBoolean",
2615:                                            "PREFIX:propertyFloat",
2616:                                            "PREFIX:propertyBigDecimal" },
2617:                                    "PREFIX:");
2618:                    assertEquals(property_types.size(), 10);
2619:                    assertTrue(property_types
2620:                            .containsKey("PREFIX:propertyStringbuffer"));
2621:                    assertTrue(property_types
2622:                            .containsKey("PREFIX:propertyDate"));
2623:                    assertTrue(property_types
2624:                            .containsKey("PREFIX:propertyTime"));
2625:                    assertTrue(property_types
2626:                            .containsKey("PREFIX:propertyTimestamp"));
2627:                    assertTrue(property_types
2628:                            .containsKey("PREFIX:propertyChar"));
2629:                    assertTrue(property_types
2630:                            .containsKey("PREFIX:propertyByte"));
2631:                    assertTrue(property_types
2632:                            .containsKey("PREFIX:propertyDouble"));
2633:                    assertTrue(property_types.containsKey("PREFIX:propertyInt"));
2634:                    assertTrue(property_types
2635:                            .containsKey("PREFIX:propertyLong"));
2636:                    assertTrue(property_types
2637:                            .containsKey("PREFIX:propertyShort"));
2638:                    assertSame(property_types
2639:                            .get("PREFIX:propertyStringbuffer"),
2640:                            StringBuffer.class);
2641:                    assertSame(property_types.get("PREFIX:propertyDate"),
2642:                            java.util.Date.class);
2643:                    assertSame(property_types.get("PREFIX:propertyTime"),
2644:                            java.sql.Time.class);
2645:                    assertSame(property_types.get("PREFIX:propertyTimestamp"),
2646:                            java.sql.Timestamp.class);
2647:                    assertSame(property_types.get("PREFIX:propertyChar"),
2648:                            char.class);
2649:                    assertSame(property_types.get("PREFIX:propertyByte"),
2650:                            byte.class);
2651:                    assertSame(property_types.get("PREFIX:propertyDouble"),
2652:                            double.class);
2653:                    assertSame(property_types.get("PREFIX:propertyInt"),
2654:                            int.class);
2655:                    assertSame(property_types.get("PREFIX:propertyLong"),
2656:                            long.class);
2657:                    assertSame(property_types.get("PREFIX:propertyShort"),
2658:                            short.class);
2659:                } catch (BeanUtilsException e) {
2660:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2661:                }
2662:            }
2663:
2664:            public void testPropertyTypesExcludedPrefixGetters() {
2665:                try {
2666:                    Map<String, Class> property_types = BeanUtils
2667:                            .getPropertyTypes(BeanUtils.GETTERS,
2668:                                    BeanImpl.class, null, new String[] {
2669:                                            "PREFIX:propertyString",
2670:                                            "PREFIX:propertyCalendar",
2671:                                            "PREFIX:propertySqlDate",
2672:                                            "PREFIX:propertyBoolean",
2673:                                            "PREFIX:propertyFloat",
2674:                                            "PREFIX:propertyBigDecimal" },
2675:                                    "PREFIX:");
2676:                    assertEquals(property_types.size(), 11);
2677:                    assertTrue(property_types
2678:                            .containsKey("PREFIX:propertyReadonly"));
2679:                    assertTrue(property_types
2680:                            .containsKey("PREFIX:propertyStringbuffer"));
2681:                    assertTrue(property_types
2682:                            .containsKey("PREFIX:propertyDate"));
2683:                    assertTrue(property_types
2684:                            .containsKey("PREFIX:propertyTime"));
2685:                    assertTrue(property_types
2686:                            .containsKey("PREFIX:propertyTimestamp"));
2687:                    assertTrue(property_types
2688:                            .containsKey("PREFIX:propertyChar"));
2689:                    assertTrue(property_types
2690:                            .containsKey("PREFIX:propertyByte"));
2691:                    assertTrue(property_types
2692:                            .containsKey("PREFIX:propertyDouble"));
2693:                    assertTrue(property_types.containsKey("PREFIX:propertyInt"));
2694:                    assertTrue(property_types
2695:                            .containsKey("PREFIX:propertyLong"));
2696:                    assertTrue(property_types
2697:                            .containsKey("PREFIX:propertyShort"));
2698:                    assertSame(property_types.get("PREFIX:propertyReadonly"),
2699:                            int.class);
2700:                    assertSame(property_types
2701:                            .get("PREFIX:propertyStringbuffer"),
2702:                            StringBuffer.class);
2703:                    assertSame(property_types.get("PREFIX:propertyDate"),
2704:                            java.util.Date.class);
2705:                    assertSame(property_types.get("PREFIX:propertyTime"),
2706:                            java.sql.Time.class);
2707:                    assertSame(property_types.get("PREFIX:propertyTimestamp"),
2708:                            java.sql.Timestamp.class);
2709:                    assertSame(property_types.get("PREFIX:propertyChar"),
2710:                            char.class);
2711:                    assertSame(property_types.get("PREFIX:propertyByte"),
2712:                            byte.class);
2713:                    assertSame(property_types.get("PREFIX:propertyDouble"),
2714:                            double.class);
2715:                    assertSame(property_types.get("PREFIX:propertyInt"),
2716:                            int.class);
2717:                    assertSame(property_types.get("PREFIX:propertyLong"),
2718:                            long.class);
2719:                    assertSame(property_types.get("PREFIX:propertyShort"),
2720:                            short.class);
2721:                } catch (BeanUtilsException e) {
2722:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2723:                }
2724:            }
2725:
2726:            public void testPropertyTypesExcludedPrefixSetters() {
2727:                try {
2728:                    Map<String, Class> property_types = BeanUtils
2729:                            .getPropertyTypes(BeanUtils.SETTERS,
2730:                                    BeanImpl.class, null, new String[] {
2731:                                            "PREFIX:propertyString",
2732:                                            "PREFIX:propertyCalendar",
2733:                                            "PREFIX:propertySqlDate",
2734:                                            "PREFIX:propertyBoolean",
2735:                                            "PREFIX:propertyFloat",
2736:                                            "PREFIX:propertyBigDecimal" },
2737:                                    "PREFIX:");
2738:                    assertEquals(property_types.size(), 11);
2739:                    assertTrue(property_types
2740:                            .containsKey("PREFIX:propertyWriteonly"));
2741:                    assertTrue(property_types
2742:                            .containsKey("PREFIX:propertyStringbuffer"));
2743:                    assertTrue(property_types
2744:                            .containsKey("PREFIX:propertyDate"));
2745:                    assertTrue(property_types
2746:                            .containsKey("PREFIX:propertyTime"));
2747:                    assertTrue(property_types
2748:                            .containsKey("PREFIX:propertyTimestamp"));
2749:                    assertTrue(property_types
2750:                            .containsKey("PREFIX:propertyChar"));
2751:                    assertTrue(property_types
2752:                            .containsKey("PREFIX:propertyByte"));
2753:                    assertTrue(property_types
2754:                            .containsKey("PREFIX:propertyDouble"));
2755:                    assertTrue(property_types.containsKey("PREFIX:propertyInt"));
2756:                    assertTrue(property_types
2757:                            .containsKey("PREFIX:propertyLong"));
2758:                    assertTrue(property_types
2759:                            .containsKey("PREFIX:propertyShort"));
2760:                    assertSame(property_types.get("PREFIX:propertyWriteonly"),
2761:                            long.class);
2762:                    assertSame(property_types
2763:                            .get("PREFIX:propertyStringbuffer"),
2764:                            StringBuffer.class);
2765:                    assertSame(property_types.get("PREFIX:propertyDate"),
2766:                            java.util.Date.class);
2767:                    assertSame(property_types.get("PREFIX:propertyTime"),
2768:                            java.sql.Time.class);
2769:                    assertSame(property_types.get("PREFIX:propertyTimestamp"),
2770:                            java.sql.Timestamp.class);
2771:                    assertSame(property_types.get("PREFIX:propertyChar"),
2772:                            char.class);
2773:                    assertSame(property_types.get("PREFIX:propertyByte"),
2774:                            byte.class);
2775:                    assertSame(property_types.get("PREFIX:propertyDouble"),
2776:                            double.class);
2777:                    assertSame(property_types.get("PREFIX:propertyInt"),
2778:                            int.class);
2779:                    assertSame(property_types.get("PREFIX:propertyLong"),
2780:                            long.class);
2781:                    assertSame(property_types.get("PREFIX:propertyShort"),
2782:                            short.class);
2783:                } catch (BeanUtilsException e) {
2784:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2785:                }
2786:            }
2787:
2788:            public void testPropertyTypesFiltered() {
2789:                try {
2790:                    Map<String, Class> property_types = BeanUtils
2791:                            .getPropertyTypes(BeanImpl.class, new String[] {
2792:                                    "propertyReadonly", "propertyWriteonly",
2793:                                    "propertyString", "propertyDate",
2794:                                    "propertySqlDate", "propertyTime",
2795:                                    "propertyByte", "propertyFloat",
2796:                                    "propertyShort" }, new String[] {
2797:                                    "propertyString", "propertyCalendar",
2798:                                    "propertySqlDate", "propertyBoolean",
2799:                                    "propertyFloat", "propertyBigDecimal" },
2800:                                    null);
2801:                    assertEquals(property_types.size(), 4);
2802:                    assertTrue(property_types.containsKey("propertyDate"));
2803:                    assertTrue(property_types.containsKey("propertyTime"));
2804:                    assertTrue(property_types.containsKey("propertyByte"));
2805:                    assertTrue(property_types.containsKey("propertyShort"));
2806:                    assertSame(property_types.get("propertyDate"),
2807:                            java.util.Date.class);
2808:                    assertSame(property_types.get("propertyTime"),
2809:                            java.sql.Time.class);
2810:                    assertSame(property_types.get("propertyByte"), byte.class);
2811:                    assertSame(property_types.get("propertyShort"), short.class);
2812:                } catch (BeanUtilsException e) {
2813:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2814:                }
2815:            }
2816:
2817:            public void testPropertyTypesFilteredGetters() {
2818:                try {
2819:                    Map<String, Class> property_types = BeanUtils
2820:                            .getPropertyTypes(BeanUtils.GETTERS,
2821:                                    BeanImpl.class, new String[] {
2822:                                            "propertyReadonly",
2823:                                            "propertyWriteonly",
2824:                                            "propertyString", "propertyDate",
2825:                                            "propertySqlDate", "propertyTime",
2826:                                            "propertyByte", "propertyFloat",
2827:                                            "propertyShort" }, new String[] {
2828:                                            "propertyString",
2829:                                            "propertyCalendar",
2830:                                            "propertySqlDate",
2831:                                            "propertyBoolean", "propertyFloat",
2832:                                            "propertyBigDecimal" }, null);
2833:                    assertEquals(property_types.size(), 5);
2834:                    assertTrue(property_types.containsKey("propertyReadonly"));
2835:                    assertTrue(property_types.containsKey("propertyDate"));
2836:                    assertTrue(property_types.containsKey("propertyTime"));
2837:                    assertTrue(property_types.containsKey("propertyByte"));
2838:                    assertTrue(property_types.containsKey("propertyShort"));
2839:                    assertSame(property_types.get("propertyReadonly"),
2840:                            int.class);
2841:                    assertSame(property_types.get("propertyDate"),
2842:                            java.util.Date.class);
2843:                    assertSame(property_types.get("propertyTime"),
2844:                            java.sql.Time.class);
2845:                    assertSame(property_types.get("propertyByte"), byte.class);
2846:                    assertSame(property_types.get("propertyShort"), short.class);
2847:                } catch (BeanUtilsException e) {
2848:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2849:                }
2850:            }
2851:
2852:            public void testPropertyTypesFilteredSetters() {
2853:                try {
2854:                    Map<String, Class> property_types = BeanUtils
2855:                            .getPropertyTypes(BeanUtils.SETTERS,
2856:                                    BeanImpl.class, new String[] {
2857:                                            "propertyReadonly",
2858:                                            "propertyWriteonly",
2859:                                            "propertyString", "propertyDate",
2860:                                            "propertySqlDate", "propertyTime",
2861:                                            "propertyByte", "propertyFloat",
2862:                                            "propertyShort" }, new String[] {
2863:                                            "propertyString",
2864:                                            "propertyCalendar",
2865:                                            "propertySqlDate",
2866:                                            "propertyBoolean", "propertyFloat",
2867:                                            "propertyBigDecimal" }, null);
2868:                    assertEquals(property_types.size(), 5);
2869:                    assertTrue(property_types.containsKey("propertyWriteonly"));
2870:                    assertTrue(property_types.containsKey("propertyDate"));
2871:                    assertTrue(property_types.containsKey("propertyTime"));
2872:                    assertTrue(property_types.containsKey("propertyByte"));
2873:                    assertTrue(property_types.containsKey("propertyShort"));
2874:                    assertSame(property_types.get("propertyWriteonly"),
2875:                            long.class);
2876:                    assertSame(property_types.get("propertyDate"),
2877:                            java.util.Date.class);
2878:                    assertSame(property_types.get("propertyTime"),
2879:                            java.sql.Time.class);
2880:                    assertSame(property_types.get("propertyByte"), byte.class);
2881:                    assertSame(property_types.get("propertyShort"), short.class);
2882:                } catch (BeanUtilsException e) {
2883:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2884:                }
2885:            }
2886:
2887:            public void testPropertyTypesFilteredPrefix() {
2888:                try {
2889:                    Map<String, Class> property_types = BeanUtils
2890:                            .getPropertyTypes(BeanImpl.class, new String[] {
2891:                                    "PREFIX:propertyReadonly",
2892:                                    "PREFIX:propertyWriteonly",
2893:                                    "PREFIX:propertyString",
2894:                                    "PREFIX:propertyDate",
2895:                                    "PREFIX:propertySqlDate",
2896:                                    "PREFIX:propertyTime",
2897:                                    "PREFIX:propertyByte",
2898:                                    "PREFIX:propertyFloat",
2899:                                    "PREFIX:propertyShort" }, new String[] {
2900:                                    "PREFIX:propertyString",
2901:                                    "PREFIX:propertyCalendar",
2902:                                    "PREFIX:propertySqlDate",
2903:                                    "PREFIX:propertyBoolean",
2904:                                    "PREFIX:propertyFloat",
2905:                                    "PREFIX:propertyBigDecimal" }, "PREFIX:");
2906:                    assertEquals(property_types.size(), 4);
2907:                    assertTrue(property_types
2908:                            .containsKey("PREFIX:propertyDate"));
2909:                    assertTrue(property_types
2910:                            .containsKey("PREFIX:propertyTime"));
2911:                    assertTrue(property_types
2912:                            .containsKey("PREFIX:propertyByte"));
2913:                    assertTrue(property_types
2914:                            .containsKey("PREFIX:propertyShort"));
2915:                    assertSame(property_types.get("PREFIX:propertyDate"),
2916:                            java.util.Date.class);
2917:                    assertSame(property_types.get("PREFIX:propertyTime"),
2918:                            java.sql.Time.class);
2919:                    assertSame(property_types.get("PREFIX:propertyByte"),
2920:                            byte.class);
2921:                    assertSame(property_types.get("PREFIX:propertyShort"),
2922:                            short.class);
2923:                } catch (BeanUtilsException e) {
2924:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2925:                }
2926:            }
2927:
2928:            public void testPropertyTypesFilteredPrefixGetters() {
2929:                try {
2930:                    Map<String, Class> property_types = BeanUtils
2931:                            .getPropertyTypes(BeanUtils.GETTERS,
2932:                                    BeanImpl.class, new String[] {
2933:                                            "PREFIX:propertyReadonly",
2934:                                            "PREFIX:propertyWriteonly",
2935:                                            "PREFIX:propertyString",
2936:                                            "PREFIX:propertyDate",
2937:                                            "PREFIX:propertySqlDate",
2938:                                            "PREFIX:propertyTime",
2939:                                            "PREFIX:propertyByte",
2940:                                            "PREFIX:propertyFloat",
2941:                                            "PREFIX:propertyShort" },
2942:                                    new String[] { "PREFIX:propertyString",
2943:                                            "PREFIX:propertyCalendar",
2944:                                            "PREFIX:propertySqlDate",
2945:                                            "PREFIX:propertyBoolean",
2946:                                            "PREFIX:propertyFloat",
2947:                                            "PREFIX:propertyBigDecimal" },
2948:                                    "PREFIX:");
2949:                    assertEquals(property_types.size(), 5);
2950:                    assertTrue(property_types
2951:                            .containsKey("PREFIX:propertyReadonly"));
2952:                    assertTrue(property_types
2953:                            .containsKey("PREFIX:propertyDate"));
2954:                    assertTrue(property_types
2955:                            .containsKey("PREFIX:propertyTime"));
2956:                    assertTrue(property_types
2957:                            .containsKey("PREFIX:propertyByte"));
2958:                    assertTrue(property_types
2959:                            .containsKey("PREFIX:propertyShort"));
2960:                    assertSame(property_types.get("PREFIX:propertyReadonly"),
2961:                            int.class);
2962:                    assertSame(property_types.get("PREFIX:propertyDate"),
2963:                            java.util.Date.class);
2964:                    assertSame(property_types.get("PREFIX:propertyTime"),
2965:                            java.sql.Time.class);
2966:                    assertSame(property_types.get("PREFIX:propertyByte"),
2967:                            byte.class);
2968:                    assertSame(property_types.get("PREFIX:propertyShort"),
2969:                            short.class);
2970:                } catch (BeanUtilsException e) {
2971:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2972:                }
2973:            }
2974:
2975:            public void testPropertyTypesFilteredPrefixSetters() {
2976:                try {
2977:                    Map<String, Class> property_types = BeanUtils
2978:                            .getPropertyTypes(BeanUtils.SETTERS,
2979:                                    BeanImpl.class, new String[] {
2980:                                            "PREFIX:propertyReadonly",
2981:                                            "PREFIX:propertyWriteonly",
2982:                                            "PREFIX:propertyString",
2983:                                            "PREFIX:propertyDate",
2984:                                            "PREFIX:propertySqlDate",
2985:                                            "PREFIX:propertyTime",
2986:                                            "PREFIX:propertyByte",
2987:                                            "PREFIX:propertyFloat",
2988:                                            "PREFIX:propertyShort" },
2989:                                    new String[] { "PREFIX:propertyString",
2990:                                            "PREFIX:propertyCalendar",
2991:                                            "PREFIX:propertySqlDate",
2992:                                            "PREFIX:propertyBoolean",
2993:                                            "PREFIX:propertyFloat",
2994:                                            "PREFIX:propertyBigDecimal" },
2995:                                    "PREFIX:");
2996:                    assertEquals(property_types.size(), 5);
2997:                    assertTrue(property_types
2998:                            .containsKey("PREFIX:propertyWriteonly"));
2999:                    assertTrue(property_types
3000:                            .containsKey("PREFIX:propertyDate"));
3001:                    assertTrue(property_types
3002:                            .containsKey("PREFIX:propertyTime"));
3003:                    assertTrue(property_types
3004:                            .containsKey("PREFIX:propertyByte"));
3005:                    assertTrue(property_types
3006:                            .containsKey("PREFIX:propertyShort"));
3007:                    assertSame(property_types.get("PREFIX:propertyWriteonly"),
3008:                            long.class);
3009:                    assertSame(property_types.get("PREFIX:propertyDate"),
3010:                            java.util.Date.class);
3011:                    assertSame(property_types.get("PREFIX:propertyTime"),
3012:                            java.sql.Time.class);
3013:                    assertSame(property_types.get("PREFIX:propertyByte"),
3014:                            byte.class);
3015:                    assertSame(property_types.get("PREFIX:propertyShort"),
3016:                            short.class);
3017:                } catch (BeanUtilsException e) {
3018:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3019:                }
3020:            }
3021:
3022:            public void testGetPropertyValueIllegal() {
3023:                try {
3024:                    BeanUtils.getPropertyValue(null, null);
3025:                    fail();
3026:                } catch (IllegalArgumentException e) {
3027:                    assertTrue(true);
3028:                } catch (BeanUtilsException e) {
3029:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3030:                }
3031:
3032:                try {
3033:                    BeanUtils.getPropertyValue(Object.class, null);
3034:                    fail();
3035:                } catch (IllegalArgumentException e) {
3036:                    assertTrue(true);
3037:                } catch (BeanUtilsException e) {
3038:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3039:                }
3040:
3041:                try {
3042:                    BeanUtils.getPropertyValue(new Object(), null);
3043:                    fail();
3044:                } catch (IllegalArgumentException e) {
3045:                    assertTrue(true);
3046:                } catch (BeanUtilsException e) {
3047:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3048:                }
3049:
3050:                try {
3051:                    BeanUtils.getPropertyValue(new Object(), "");
3052:                    fail();
3053:                } catch (IllegalArgumentException e) {
3054:                    assertTrue(true);
3055:                } catch (BeanUtilsException e) {
3056:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3057:                }
3058:            }
3059:
3060:            public void testGetPropertyValue() {
3061:                Object bean = getPopulatedBean();
3062:                try {
3063:                    Calendar cal = Calendar.getInstance();
3064:                    cal.set(2002, 11, 26, 22, 52, 31);
3065:                    cal.set(Calendar.MILLISECOND, 153);
3066:                    assertEquals(BeanUtils.getPropertyValue(bean,
3067:                            "propertyString"), "thisisastring");
3068:                    assertEquals(BeanUtils.getPropertyValue(bean,
3069:                            "propertyStringbuffer").toString(),
3070:                            new StringBuffer("butthisisastringbuffer")
3071:                                    .toString());
3072:                    assertEquals(BeanUtils.getPropertyValue(bean,
3073:                            "propertyDate"), cal.getTime());
3074:                    assertEquals(BeanUtils.getPropertyValue(bean,
3075:                            "propertyCalendar"), cal);
3076:                    assertEquals(BeanUtils.getPropertyValue(bean,
3077:                            "propertySqlDate"), new java.sql.Date(cal.getTime()
3078:                            .getTime()));
3079:                    assertEquals(BeanUtils.getPropertyValue(bean,
3080:                            "propertyTime"), new Time(cal.getTime().getTime()));
3081:                    assertEquals(BeanUtils.getPropertyValue(bean,
3082:                            "propertyTimestamp"), new Timestamp(cal.getTime()
3083:                            .getTime()));
3084:                    assertEquals(BeanUtils.getPropertyValue(bean,
3085:                            "propertyChar"), new Character('g'));
3086:                    assertEquals(BeanUtils.getPropertyValue(bean,
3087:                            "propertyBoolean"), new Boolean(false));
3088:                    assertEquals(BeanUtils.getPropertyValue(bean,
3089:                            "propertyByte"), new Byte((byte) 53));
3090:                    assertEquals(BeanUtils.getPropertyValue(bean,
3091:                            "propertyDouble"), new Double(84578.42d));
3092:                    assertEquals(BeanUtils.getPropertyValue(bean,
3093:                            "propertyFloat"), new Float(35523.967f));
3094:                    assertEquals(BeanUtils
3095:                            .getPropertyValue(bean, "propertyInt"),
3096:                            new Integer(978));
3097:                    assertEquals(BeanUtils.getPropertyValue(bean,
3098:                            "propertyLong"), new Long(87346L));
3099:                    assertEquals(BeanUtils.getPropertyValue(bean,
3100:                            "propertyShort"), new Short((short) 31));
3101:                    assertEquals(BeanUtils.getPropertyValue(bean,
3102:                            "propertyBigDecimal"), new BigDecimal(
3103:                            "8347365990.387437894678"));
3104:                } catch (BeanUtilsException e) {
3105:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3106:                }
3107:
3108:                try {
3109:                    BeanUtils.getPropertyValue(bean, "unknown");
3110:                    fail();
3111:                } catch (BeanUtilsException e) {
3112:                    assertSame(e.getBeanClass(), bean.getClass());
3113:                }
3114:            }
3115:
3116:            public void testSetPropertyValue() {
3117:                BeanImpl bean = new BeanImpl();
3118:                try {
3119:                    Calendar cal = Calendar.getInstance();
3120:                    cal.set(2002, 11, 26, 22, 52, 31);
3121:                    cal.set(Calendar.MILLISECOND, 153);
3122:                    BeanUtils.setPropertyValue(bean, "propertyString",
3123:                            "thisisastring");
3124:                    BeanUtils.setPropertyValue(bean, "propertyStringbuffer",
3125:                            new StringBuffer("butthisisastringbuffer"));
3126:                    BeanUtils.setPropertyValue(bean, "propertyDate", cal
3127:                            .getTime());
3128:                    BeanUtils.setPropertyValue(bean, "propertyCalendar", cal);
3129:                    BeanUtils.setPropertyValue(bean, "propertySqlDate",
3130:                            new java.sql.Date(cal.getTime().getTime()));
3131:                    BeanUtils.setPropertyValue(bean, "propertyTime", new Time(
3132:                            cal.getTime().getTime()));
3133:                    BeanUtils.setPropertyValue(bean, "propertyTimestamp",
3134:                            new Timestamp(cal.getTime().getTime()));
3135:                    BeanUtils.setPropertyValue(bean, "propertyChar",
3136:                            new Character('g'));
3137:                    BeanUtils.setPropertyValue(bean, "propertyBoolean",
3138:                            new Boolean(false));
3139:                    BeanUtils.setPropertyValue(bean, "propertyByte", new Byte(
3140:                            (byte) 53));
3141:                    BeanUtils.setPropertyValue(bean, "propertyDouble",
3142:                            new Double(84578.42d));
3143:                    BeanUtils.setPropertyValue(bean, "propertyFloat",
3144:                            new Float(35523.967f));
3145:                    BeanUtils.setPropertyValue(bean, "propertyInt",
3146:                            new Integer(978));
3147:                    BeanUtils.setPropertyValue(bean, "propertyLong", new Long(
3148:                            87346L));
3149:                    BeanUtils.setPropertyValue(bean, "propertyShort",
3150:                            new Short((short) 31));
3151:                    BeanUtils.setPropertyValue(bean, "propertyBigDecimal",
3152:                            new BigDecimal("8347365990.387437894678"));
3153:                } catch (BeanUtilsException e) {
3154:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3155:                }
3156:
3157:                BeanImpl populated = getPopulatedBean();
3158:                assertEquals(bean.getPropertyString(), populated
3159:                        .getPropertyString());
3160:                assertEquals(bean.getPropertyStringbuffer().toString(),
3161:                        populated.getPropertyStringbuffer().toString());
3162:                assertEquals(bean.getPropertyDate(), populated
3163:                        .getPropertyDate());
3164:                assertEquals(bean.getPropertyCalendar(), populated
3165:                        .getPropertyCalendar());
3166:                assertEquals(bean.getPropertySqlDate(), populated
3167:                        .getPropertySqlDate());
3168:                assertEquals(bean.getPropertyTime(), populated
3169:                        .getPropertyTime());
3170:                assertEquals(bean.getPropertyTimestamp(), populated
3171:                        .getPropertyTimestamp());
3172:                assertEquals(bean.getPropertyChar(), populated
3173:                        .getPropertyChar());
3174:                assertEquals(bean.isPropertyBoolean(), populated
3175:                        .isPropertyBoolean());
3176:                assertEquals(bean.getPropertyByte(), populated
3177:                        .getPropertyByte());
3178:                assertEquals(bean.getPropertyDouble(), populated
3179:                        .getPropertyDouble());
3180:                assertEquals(bean.getPropertyFloat(), populated
3181:                        .getPropertyFloat());
3182:                assertEquals(bean.getPropertyInt(), populated.getPropertyInt());
3183:                assertEquals(bean.getPropertyLong(), populated
3184:                        .getPropertyLong());
3185:                assertEquals(bean.getPropertyShort(), populated
3186:                        .getPropertyShort());
3187:                assertEquals(bean.getPropertyBigDecimal(), populated
3188:                        .getPropertyBigDecimal());
3189:
3190:                try {
3191:                    BeanUtils.setPropertyValue(bean, "unknown", "ok");
3192:                    fail();
3193:                } catch (BeanUtilsException e) {
3194:                    assertSame(e.getBeanClass(), bean.getClass());
3195:                }
3196:            }
3197:
3198:            public void testGetPropertyValuesIllegal() {
3199:                try {
3200:                    assertEquals(0, BeanUtils.getPropertyValues(null, null,
3201:                            null, null).size());
3202:                } catch (BeanUtilsException e) {
3203:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3204:                }
3205:
3206:                try {
3207:                    BeanUtils.getPropertyValues(Object.class, null, null, null);
3208:                    fail();
3209:                } catch (IllegalArgumentException e) {
3210:                    assertTrue(true);
3211:                } catch (BeanUtilsException e) {
3212:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3213:                }
3214:            }
3215:
3216:            public void testGetPropertyValues() {
3217:                try {
3218:                    Map<String, Object> property_values = BeanUtils
3219:                            .getPropertyValues(getPopulatedBean(), null, null,
3220:                                    null);
3221:                    assertEquals(property_values.size(), 16);
3222:                    assertTrue(property_values.containsKey("propertyString"));
3223:                    assertTrue(property_values
3224:                            .containsKey("propertyStringbuffer"));
3225:                    assertTrue(property_values.containsKey("propertyDate"));
3226:                    assertTrue(property_values.containsKey("propertyCalendar"));
3227:                    assertTrue(property_values.containsKey("propertySqlDate"));
3228:                    assertTrue(property_values.containsKey("propertyTime"));
3229:                    assertTrue(property_values.containsKey("propertyTimestamp"));
3230:                    assertTrue(property_values.containsKey("propertyChar"));
3231:                    assertTrue(property_values.containsKey("propertyBoolean"));
3232:                    assertTrue(property_values.containsKey("propertyByte"));
3233:                    assertTrue(property_values.containsKey("propertyDouble"));
3234:                    assertTrue(property_values.containsKey("propertyFloat"));
3235:                    assertTrue(property_values.containsKey("propertyInt"));
3236:                    assertTrue(property_values.containsKey("propertyLong"));
3237:                    assertTrue(property_values.containsKey("propertyShort"));
3238:                    assertTrue(property_values
3239:                            .containsKey("propertyBigDecimal"));
3240:
3241:                    Calendar cal = Calendar.getInstance();
3242:                    cal.set(2002, 11, 26, 22, 52, 31);
3243:                    cal.set(Calendar.MILLISECOND, 153);
3244:                    assertEquals(property_values.get("propertyString"),
3245:                            "thisisastring");
3246:                    assertEquals(property_values.get("propertyStringbuffer")
3247:                            .toString(), new StringBuffer(
3248:                            "butthisisastringbuffer").toString());
3249:                    assertEquals(property_values.get("propertyDate"), cal
3250:                            .getTime());
3251:                    assertEquals(property_values.get("propertyCalendar"), cal);
3252:                    assertEquals(property_values.get("propertySqlDate"),
3253:                            new java.sql.Date(cal.getTime().getTime()));
3254:                    assertEquals(property_values.get("propertyTime"), new Time(
3255:                            cal.getTime().getTime()));
3256:                    assertEquals(property_values.get("propertyTimestamp"),
3257:                            new Timestamp(cal.getTime().getTime()));
3258:                    assertEquals(property_values.get("propertyChar"),
3259:                            new Character('g'));
3260:                    assertEquals(property_values.get("propertyBoolean"),
3261:                            new Boolean(false));
3262:                    assertEquals(property_values.get("propertyByte"), new Byte(
3263:                            (byte) 53));
3264:                    assertEquals(property_values.get("propertyDouble"),
3265:                            new Double(84578.42d));
3266:                    assertEquals(property_values.get("propertyFloat"),
3267:                            new Float(35523.967f));
3268:                    assertEquals(property_values.get("propertyInt"),
3269:                            new Integer(978));
3270:                    assertEquals(property_values.get("propertyLong"), new Long(
3271:                            87346L));
3272:                    assertEquals(property_values.get("propertyShort"),
3273:                            new Short((short) 31));
3274:                    assertEquals(property_values.get("propertyBigDecimal"),
3275:                            new BigDecimal("8347365990.387437894678"));
3276:                } catch (BeanUtilsException e) {
3277:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3278:                }
3279:            }
3280:
3281:            public void testGetPropertyValuesGetters() {
3282:                try {
3283:                    Map<String, Object> property_values = BeanUtils
3284:                            .getPropertyValues(BeanUtils.GETTERS,
3285:                                    getPopulatedBean(), null, null, null);
3286:                    assertEquals(property_values.size(), 17);
3287:                    assertTrue(property_values.containsKey("propertyReadonly"));
3288:                    assertTrue(property_values.containsKey("propertyString"));
3289:                    assertTrue(property_values
3290:                            .containsKey("propertyStringbuffer"));
3291:                    assertTrue(property_values.containsKey("propertyDate"));
3292:                    assertTrue(property_values.containsKey("propertyCalendar"));
3293:                    assertTrue(property_values.containsKey("propertySqlDate"));
3294:                    assertTrue(property_values.containsKey("propertyTime"));
3295:                    assertTrue(property_values.containsKey("propertyTimestamp"));
3296:                    assertTrue(property_values.containsKey("propertyChar"));
3297:                    assertTrue(property_values.containsKey("propertyBoolean"));
3298:                    assertTrue(property_values.containsKey("propertyByte"));
3299:                    assertTrue(property_values.containsKey("propertyDouble"));
3300:                    assertTrue(property_values.containsKey("propertyFloat"));
3301:                    assertTrue(property_values.containsKey("propertyInt"));
3302:                    assertTrue(property_values.containsKey("propertyLong"));
3303:                    assertTrue(property_values.containsKey("propertyShort"));
3304:                    assertTrue(property_values
3305:                            .containsKey("propertyBigDecimal"));
3306:
3307:                    Calendar cal = Calendar.getInstance();
3308:                    cal.set(2002, 11, 26, 22, 52, 31);
3309:                    cal.set(Calendar.MILLISECOND, 153);
3310:                    assertEquals(property_values.get("propertyReadonly"), 23);
3311:                    assertEquals(property_values.get("propertyString"),
3312:                            "thisisastring");
3313:                    assertEquals(property_values.get("propertyStringbuffer")
3314:                            .toString(), new StringBuffer(
3315:                            "butthisisastringbuffer").toString());
3316:                    assertEquals(property_values.get("propertyDate"), cal
3317:                            .getTime());
3318:                    assertEquals(property_values.get("propertyCalendar"), cal);
3319:                    assertEquals(property_values.get("propertySqlDate"),
3320:                            new java.sql.Date(cal.getTime().getTime()));
3321:                    assertEquals(property_values.get("propertyTime"), new Time(
3322:                            cal.getTime().getTime()));
3323:                    assertEquals(property_values.get("propertyTimestamp"),
3324:                            new Timestamp(cal.getTime().getTime()));
3325:                    assertEquals(property_values.get("propertyChar"),
3326:                            new Character('g'));
3327:                    assertEquals(property_values.get("propertyBoolean"),
3328:                            new Boolean(false));
3329:                    assertEquals(property_values.get("propertyByte"), new Byte(
3330:                            (byte) 53));
3331:                    assertEquals(property_values.get("propertyDouble"),
3332:                            new Double(84578.42d));
3333:                    assertEquals(property_values.get("propertyFloat"),
3334:                            new Float(35523.967f));
3335:                    assertEquals(property_values.get("propertyInt"),
3336:                            new Integer(978));
3337:                    assertEquals(property_values.get("propertyLong"), new Long(
3338:                            87346L));
3339:                    assertEquals(property_values.get("propertyShort"),
3340:                            new Short((short) 31));
3341:                    assertEquals(property_values.get("propertyBigDecimal"),
3342:                            new BigDecimal("8347365990.387437894678"));
3343:                } catch (BeanUtilsException e) {
3344:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3345:                }
3346:            }
3347:
3348:            public void testGetPropertyValuesSetters() {
3349:                try {
3350:                    Map<String, Object> property_values = BeanUtils
3351:                            .getPropertyValues(BeanUtils.SETTERS,
3352:                                    getPopulatedBean(), null, null, null);
3353:                    assertEquals(property_values.size(), 16);
3354:                    assertTrue(property_values.containsKey("propertyString"));
3355:                    assertTrue(property_values
3356:                            .containsKey("propertyStringbuffer"));
3357:                    assertTrue(property_values.containsKey("propertyDate"));
3358:                    assertTrue(property_values.containsKey("propertyCalendar"));
3359:                    assertTrue(property_values.containsKey("propertySqlDate"));
3360:                    assertTrue(property_values.containsKey("propertyTime"));
3361:                    assertTrue(property_values.containsKey("propertyTimestamp"));
3362:                    assertTrue(property_values.containsKey("propertyChar"));
3363:                    assertTrue(property_values.containsKey("propertyBoolean"));
3364:                    assertTrue(property_values.containsKey("propertyByte"));
3365:                    assertTrue(property_values.containsKey("propertyDouble"));
3366:                    assertTrue(property_values.containsKey("propertyFloat"));
3367:                    assertTrue(property_values.containsKey("propertyInt"));
3368:                    assertTrue(property_values.containsKey("propertyLong"));
3369:                    assertTrue(property_values.containsKey("propertyShort"));
3370:                    assertTrue(property_values
3371:                            .containsKey("propertyBigDecimal"));
3372:
3373:                    Calendar cal = Calendar.getInstance();
3374:                    cal.set(2002, 11, 26, 22, 52, 31);
3375:                    cal.set(Calendar.MILLISECOND, 153);
3376:                    assertEquals(property_values.get("propertyString"),
3377:                            "thisisastring");
3378:                    assertEquals(property_values.get("propertyStringbuffer")
3379:                            .toString(), new StringBuffer(
3380:                            "butthisisastringbuffer").toString());
3381:                    assertEquals(property_values.get("propertyDate"), cal
3382:                            .getTime());
3383:                    assertEquals(property_values.get("propertyCalendar"), cal);
3384:                    assertEquals(property_values.get("propertySqlDate"),
3385:                            new java.sql.Date(cal.getTime().getTime()));
3386:                    assertEquals(property_values.get("propertyTime"), new Time(
3387:                            cal.getTime().getTime()));
3388:                    assertEquals(property_values.get("propertyTimestamp"),
3389:                            new Timestamp(cal.getTime().getTime()));
3390:                    assertEquals(property_values.get("propertyChar"),
3391:                            new Character('g'));
3392:                    assertEquals(property_values.get("propertyBoolean"),
3393:                            new Boolean(false));
3394:                    assertEquals(property_values.get("propertyByte"), new Byte(
3395:                            (byte) 53));
3396:                    assertEquals(property_values.get("propertyDouble"),
3397:                            new Double(84578.42d));
3398:                    assertEquals(property_values.get("propertyFloat"),
3399:                            new Float(35523.967f));
3400:                    assertEquals(property_values.get("propertyInt"),
3401:                            new Integer(978));
3402:                    assertEquals(property_values.get("propertyLong"), new Long(
3403:                            87346L));
3404:                    assertEquals(property_values.get("propertyShort"),
3405:                            new Short((short) 31));
3406:                    assertEquals(property_values.get("propertyBigDecimal"),
3407:                            new BigDecimal("8347365990.387437894678"));
3408:                } catch (BeanUtilsException e) {
3409:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3410:                }
3411:            }
3412:
3413:            public void testGetPropertyValuesPrefix() {
3414:                try {
3415:                    Map<String, Object> property_values = BeanUtils
3416:                            .getPropertyValues(getPopulatedBean(), null, null,
3417:                                    "PREFIX:");
3418:                    assertEquals(property_values.size(), 16);
3419:                    assertTrue(property_values
3420:                            .containsKey("PREFIX:propertyString"));
3421:                    assertTrue(property_values
3422:                            .containsKey("PREFIX:propertyStringbuffer"));
3423:                    assertTrue(property_values
3424:                            .containsKey("PREFIX:propertyDate"));
3425:                    assertTrue(property_values
3426:                            .containsKey("PREFIX:propertyCalendar"));
3427:                    assertTrue(property_values
3428:                            .containsKey("PREFIX:propertySqlDate"));
3429:                    assertTrue(property_values
3430:                            .containsKey("PREFIX:propertyTime"));
3431:                    assertTrue(property_values
3432:                            .containsKey("PREFIX:propertyTimestamp"));
3433:                    assertTrue(property_values
3434:                            .containsKey("PREFIX:propertyChar"));
3435:                    assertTrue(property_values
3436:                            .containsKey("PREFIX:propertyBoolean"));
3437:                    assertTrue(property_values
3438:                            .containsKey("PREFIX:propertyByte"));
3439:                    assertTrue(property_values
3440:                            .containsKey("PREFIX:propertyDouble"));
3441:                    assertTrue(property_values
3442:                            .containsKey("PREFIX:propertyFloat"));
3443:                    assertTrue(property_values
3444:                            .containsKey("PREFIX:propertyInt"));
3445:                    assertTrue(property_values
3446:                            .containsKey("PREFIX:propertyLong"));
3447:                    assertTrue(property_values
3448:                            .containsKey("PREFIX:propertyShort"));
3449:                    assertTrue(property_values
3450:                            .containsKey("PREFIX:propertyBigDecimal"));
3451:
3452:                    Calendar cal = Calendar.getInstance();
3453:                    cal.set(2002, 11, 26, 22, 52, 31);
3454:                    cal.set(Calendar.MILLISECOND, 153);
3455:                    assertEquals(property_values.get("PREFIX:propertyString"),
3456:                            "thisisastring");
3457:                    assertEquals(property_values.get(
3458:                            "PREFIX:propertyStringbuffer").toString(),
3459:                            new StringBuffer("butthisisastringbuffer")
3460:                                    .toString());
3461:                    assertEquals(property_values.get("PREFIX:propertyDate"),
3462:                            cal.getTime());
3463:                    assertEquals(
3464:                            property_values.get("PREFIX:propertyCalendar"), cal);
3465:                    assertEquals(property_values.get("PREFIX:propertySqlDate"),
3466:                            new java.sql.Date(cal.getTime().getTime()));
3467:                    assertEquals(property_values.get("PREFIX:propertyTime"),
3468:                            new Time(cal.getTime().getTime()));
3469:                    assertEquals(property_values
3470:                            .get("PREFIX:propertyTimestamp"), new Timestamp(cal
3471:                            .getTime().getTime()));
3472:                    assertEquals(property_values.get("PREFIX:propertyChar"),
3473:                            new Character('g'));
3474:                    assertEquals(property_values.get("PREFIX:propertyBoolean"),
3475:                            new Boolean(false));
3476:                    assertEquals(property_values.get("PREFIX:propertyByte"),
3477:                            new Byte((byte) 53));
3478:                    assertEquals(property_values.get("PREFIX:propertyDouble"),
3479:                            new Double(84578.42d));
3480:                    assertEquals(property_values.get("PREFIX:propertyFloat"),
3481:                            new Float(35523.967f));
3482:                    assertEquals(property_values.get("PREFIX:propertyInt"),
3483:                            new Integer(978));
3484:                    assertEquals(property_values.get("PREFIX:propertyLong"),
3485:                            new Long(87346L));
3486:                    assertEquals(property_values.get("PREFIX:propertyShort"),
3487:                            new Short((short) 31));
3488:                    assertEquals(property_values
3489:                            .get("PREFIX:propertyBigDecimal"), new BigDecimal(
3490:                            "8347365990.387437894678"));
3491:                } catch (BeanUtilsException e) {
3492:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3493:                }
3494:            }
3495:
3496:            public void testGetPropertyValuesPrefixGetters() {
3497:                try {
3498:                    Map<String, Object> property_values = BeanUtils
3499:                            .getPropertyValues(BeanUtils.GETTERS,
3500:                                    getPopulatedBean(), null, null, "PREFIX:");
3501:                    assertEquals(property_values.size(), 17);
3502:                    assertTrue(property_values
3503:                            .containsKey("PREFIX:propertyReadonly"));
3504:                    assertTrue(property_values
3505:                            .containsKey("PREFIX:propertyString"));
3506:                    assertTrue(property_values
3507:                            .containsKey("PREFIX:propertyStringbuffer"));
3508:                    assertTrue(property_values
3509:                            .containsKey("PREFIX:propertyDate"));
3510:                    assertTrue(property_values
3511:                            .containsKey("PREFIX:propertyCalendar"));
3512:                    assertTrue(property_values
3513:                            .containsKey("PREFIX:propertySqlDate"));
3514:                    assertTrue(property_values
3515:                            .containsKey("PREFIX:propertyTime"));
3516:                    assertTrue(property_values
3517:                            .containsKey("PREFIX:propertyTimestamp"));
3518:                    assertTrue(property_values
3519:                            .containsKey("PREFIX:propertyChar"));
3520:                    assertTrue(property_values
3521:                            .containsKey("PREFIX:propertyBoolean"));
3522:                    assertTrue(property_values
3523:                            .containsKey("PREFIX:propertyByte"));
3524:                    assertTrue(property_values
3525:                            .containsKey("PREFIX:propertyDouble"));
3526:                    assertTrue(property_values
3527:                            .containsKey("PREFIX:propertyFloat"));
3528:                    assertTrue(property_values
3529:                            .containsKey("PREFIX:propertyInt"));
3530:                    assertTrue(property_values
3531:                            .containsKey("PREFIX:propertyLong"));
3532:                    assertTrue(property_values
3533:                            .containsKey("PREFIX:propertyShort"));
3534:                    assertTrue(property_values
3535:                            .containsKey("PREFIX:propertyBigDecimal"));
3536:
3537:                    Calendar cal = Calendar.getInstance();
3538:                    cal.set(2002, 11, 26, 22, 52, 31);
3539:                    cal.set(Calendar.MILLISECOND, 153);
3540:                    assertEquals(
3541:                            property_values.get("PREFIX:propertyReadonly"), 23);
3542:                    assertEquals(property_values.get("PREFIX:propertyString"),
3543:                            "thisisastring");
3544:                    assertEquals(property_values.get(
3545:                            "PREFIX:propertyStringbuffer").toString(),
3546:                            new StringBuffer("butthisisastringbuffer")
3547:                                    .toString());
3548:                    assertEquals(property_values.get("PREFIX:propertyDate"),
3549:                            cal.getTime());
3550:                    assertEquals(
3551:                            property_values.get("PREFIX:propertyCalendar"), cal);
3552:                    assertEquals(property_values.get("PREFIX:propertySqlDate"),
3553:                            new java.sql.Date(cal.getTime().getTime()));
3554:                    assertEquals(property_values.get("PREFIX:propertyTime"),
3555:                            new Time(cal.getTime().getTime()));
3556:                    assertEquals(property_values
3557:                            .get("PREFIX:propertyTimestamp"), new Timestamp(cal
3558:                            .getTime().getTime()));
3559:                    assertEquals(property_values.get("PREFIX:propertyChar"),
3560:                            new Character('g'));
3561:                    assertEquals(property_values.get("PREFIX:propertyBoolean"),
3562:                            new Boolean(false));
3563:                    assertEquals(property_values.get("PREFIX:propertyByte"),
3564:                            new Byte((byte) 53));
3565:                    assertEquals(property_values.get("PREFIX:propertyDouble"),
3566:                            new Double(84578.42d));
3567:                    assertEquals(property_values.get("PREFIX:propertyFloat"),
3568:                            new Float(35523.967f));
3569:                    assertEquals(property_values.get("PREFIX:propertyInt"),
3570:                            new Integer(978));
3571:                    assertEquals(property_values.get("PREFIX:propertyLong"),
3572:                            new Long(87346L));
3573:                    assertEquals(property_values.get("PREFIX:propertyShort"),
3574:                            new Short((short) 31));
3575:                    assertEquals(property_values
3576:                            .get("PREFIX:propertyBigDecimal"), new BigDecimal(
3577:                            "8347365990.387437894678"));
3578:                } catch (BeanUtilsException e) {
3579:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3580:                }
3581:            }
3582:
3583:            public void testGetPropertyValuesPrefixSetters() {
3584:                try {
3585:                    Map<String, Object> property_values = BeanUtils
3586:                            .getPropertyValues(BeanUtils.SETTERS,
3587:                                    getPopulatedBean(), null, null, "PREFIX:");
3588:                    assertEquals(property_values.size(), 16);
3589:                    assertTrue(property_values
3590:                            .containsKey("PREFIX:propertyString"));
3591:                    assertTrue(property_values
3592:                            .containsKey("PREFIX:propertyStringbuffer"));
3593:                    assertTrue(property_values
3594:                            .containsKey("PREFIX:propertyDate"));
3595:                    assertTrue(property_values
3596:                            .containsKey("PREFIX:propertyCalendar"));
3597:                    assertTrue(property_values
3598:                            .containsKey("PREFIX:propertySqlDate"));
3599:                    assertTrue(property_values
3600:                            .containsKey("PREFIX:propertyTime"));
3601:                    assertTrue(property_values
3602:                            .containsKey("PREFIX:propertyTimestamp"));
3603:                    assertTrue(property_values
3604:                            .containsKey("PREFIX:propertyChar"));
3605:                    assertTrue(property_values
3606:                            .containsKey("PREFIX:propertyBoolean"));
3607:                    assertTrue(property_values
3608:                            .containsKey("PREFIX:propertyByte"));
3609:                    assertTrue(property_values
3610:                            .containsKey("PREFIX:propertyDouble"));
3611:                    assertTrue(property_values
3612:                            .containsKey("PREFIX:propertyFloat"));
3613:                    assertTrue(property_values
3614:                            .containsKey("PREFIX:propertyInt"));
3615:                    assertTrue(property_values
3616:                            .containsKey("PREFIX:propertyLong"));
3617:                    assertTrue(property_values
3618:                            .containsKey("PREFIX:propertyShort"));
3619:                    assertTrue(property_values
3620:                            .containsKey("PREFIX:propertyBigDecimal"));
3621:
3622:                    Calendar cal = Calendar.getInstance();
3623:                    cal.set(2002, 11, 26, 22, 52, 31);
3624:                    cal.set(Calendar.MILLISECOND, 153);
3625:                    assertEquals(property_values.get("PREFIX:propertyString"),
3626:                            "thisisastring");
3627:                    assertEquals(property_values.get(
3628:                            "PREFIX:propertyStringbuffer").toString(),
3629:                            new StringBuffer("butthisisastringbuffer")
3630:                                    .toString());
3631:                    assertEquals(property_values.get("PREFIX:propertyDate"),
3632:                            cal.getTime());
3633:                    assertEquals(
3634:                            property_values.get("PREFIX:propertyCalendar"), cal);
3635:                    assertEquals(property_values.get("PREFIX:propertySqlDate"),
3636:                            new java.sql.Date(cal.getTime().getTime()));
3637:                    assertEquals(property_values.get("PREFIX:propertyTime"),
3638:                            new Time(cal.getTime().getTime()));
3639:                    assertEquals(property_values
3640:                            .get("PREFIX:propertyTimestamp"), new Timestamp(cal
3641:                            .getTime().getTime()));
3642:                    assertEquals(property_values.get("PREFIX:propertyChar"),
3643:                            new Character('g'));
3644:                    assertEquals(property_values.get("PREFIX:propertyBoolean"),
3645:                            new Boolean(false));
3646:                    assertEquals(property_values.get("PREFIX:propertyByte"),
3647:                            new Byte((byte) 53));
3648:                    assertEquals(property_values.get("PREFIX:propertyDouble"),
3649:                            new Double(84578.42d));
3650:                    assertEquals(property_values.get("PREFIX:propertyFloat"),
3651:                            new Float(35523.967f));
3652:                    assertEquals(property_values.get("PREFIX:propertyInt"),
3653:                            new Integer(978));
3654:                    assertEquals(property_values.get("PREFIX:propertyLong"),
3655:                            new Long(87346L));
3656:                    assertEquals(property_values.get("PREFIX:propertyShort"),
3657:                            new Short((short) 31));
3658:                    assertEquals(property_values
3659:                            .get("PREFIX:propertyBigDecimal"), new BigDecimal(
3660:                            "8347365990.387437894678"));
3661:                } catch (BeanUtilsException e) {
3662:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3663:                }
3664:            }
3665:
3666:            public void testGetPropertyValuesIncluded() {
3667:                try {
3668:                    Map<String, Object> property_values = BeanUtils
3669:                            .getPropertyValues(getPopulatedBean(),
3670:                                    new String[] { "propertyReadonly",
3671:                                            "propertyWriteonly",
3672:                                            "propertyString", "propertyDate",
3673:                                            "propertySqlDate", "propertyTime",
3674:                                            "propertyByte", "propertyFloat",
3675:                                            "propertyShort" }, null, null);
3676:                    assertEquals(property_values.size(), 7);
3677:                    assertTrue(property_values.containsKey("propertyString"));
3678:                    assertTrue(property_values.containsKey("propertyDate"));
3679:                    assertTrue(property_values.containsKey("propertySqlDate"));
3680:                    assertTrue(property_values.containsKey("propertyTime"));
3681:                    assertTrue(property_values.containsKey("propertyByte"));
3682:                    assertTrue(property_values.containsKey("propertyFloat"));
3683:                    assertTrue(property_values.containsKey("propertyShort"));
3684:
3685:                    Calendar cal = Calendar.getInstance();
3686:                    cal.set(2002, 11, 26, 22, 52, 31);
3687:                    cal.set(Calendar.MILLISECOND, 153);
3688:                    assertEquals(property_values.get("propertyString"),
3689:                            "thisisastring");
3690:                    assertEquals(property_values.get("propertyDate"), cal
3691:                            .getTime());
3692:                    assertEquals(property_values.get("propertySqlDate"),
3693:                            new java.sql.Date(cal.getTime().getTime()));
3694:                    assertEquals(property_values.get("propertyTime"), new Time(
3695:                            cal.getTime().getTime()));
3696:                    assertEquals(property_values.get("propertyByte"), new Byte(
3697:                            (byte) 53));
3698:                    assertEquals(property_values.get("propertyFloat"),
3699:                            new Float(35523.967f));
3700:                    assertEquals(property_values.get("propertyShort"),
3701:                            new Short((short) 31));
3702:                } catch (BeanUtilsException e) {
3703:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3704:                }
3705:            }
3706:
3707:            public void testGetPropertyValuesIncludedGetters() {
3708:                try {
3709:                    Map<String, Object> property_values = BeanUtils
3710:                            .getPropertyValues(BeanUtils.GETTERS,
3711:                                    getPopulatedBean(), new String[] {
3712:                                            "propertyReadonly",
3713:                                            "propertyWriteonly",
3714:                                            "propertyString", "propertyDate",
3715:                                            "propertySqlDate", "propertyTime",
3716:                                            "propertyByte", "propertyFloat",
3717:                                            "propertyShort" }, null, null);
3718:                    assertEquals(property_values.size(), 8);
3719:                    assertTrue(property_values.containsKey("propertyReadonly"));
3720:                    assertTrue(property_values.containsKey("propertyString"));
3721:                    assertTrue(property_values.containsKey("propertyDate"));
3722:                    assertTrue(property_values.containsKey("propertySqlDate"));
3723:                    assertTrue(property_values.containsKey("propertyTime"));
3724:                    assertTrue(property_values.containsKey("propertyByte"));
3725:                    assertTrue(property_values.containsKey("propertyFloat"));
3726:                    assertTrue(property_values.containsKey("propertyShort"));
3727:
3728:                    Calendar cal = Calendar.getInstance();
3729:                    cal.set(2002, 11, 26, 22, 52, 31);
3730:                    cal.set(Calendar.MILLISECOND, 153);
3731:                    assertEquals(property_values.get("propertyReadonly"), 23);
3732:                    assertEquals(property_values.get("propertyString"),
3733:                            "thisisastring");
3734:                    assertEquals(property_values.get("propertyDate"), cal
3735:                            .getTime());
3736:                    assertEquals(property_values.get("propertySqlDate"),
3737:                            new java.sql.Date(cal.getTime().getTime()));
3738:                    assertEquals(property_values.get("propertyTime"), new Time(
3739:                            cal.getTime().getTime()));
3740:                    assertEquals(property_values.get("propertyByte"), new Byte(
3741:                            (byte) 53));
3742:                    assertEquals(property_values.get("propertyFloat"),
3743:                            new Float(35523.967f));
3744:                    assertEquals(property_values.get("propertyShort"),
3745:                            new Short((short) 31));
3746:                } catch (BeanUtilsException e) {
3747:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3748:                }
3749:            }
3750:
3751:            public void testGetPropertyValuesIncludedSetters() {
3752:                try {
3753:                    Map<String, Object> property_values = BeanUtils
3754:                            .getPropertyValues(BeanUtils.SETTERS,
3755:                                    getPopulatedBean(), new String[] {
3756:                                            "propertyReadonly",
3757:                                            "propertyWriteonly",
3758:                                            "propertyString", "propertyDate",
3759:                                            "propertySqlDate", "propertyTime",
3760:                                            "propertyByte", "propertyFloat",
3761:                                            "propertyShort" }, null, null);
3762:                    assertEquals(property_values.size(), 7);
3763:                    assertTrue(property_values.containsKey("propertyString"));
3764:                    assertTrue(property_values.containsKey("propertyDate"));
3765:                    assertTrue(property_values.containsKey("propertySqlDate"));
3766:                    assertTrue(property_values.containsKey("propertyTime"));
3767:                    assertTrue(property_values.containsKey("propertyByte"));
3768:                    assertTrue(property_values.containsKey("propertyFloat"));
3769:                    assertTrue(property_values.containsKey("propertyShort"));
3770:
3771:                    Calendar cal = Calendar.getInstance();
3772:                    cal.set(2002, 11, 26, 22, 52, 31);
3773:                    cal.set(Calendar.MILLISECOND, 153);
3774:                    assertEquals(property_values.get("propertyString"),
3775:                            "thisisastring");
3776:                    assertEquals(property_values.get("propertyDate"), cal
3777:                            .getTime());
3778:                    assertEquals(property_values.get("propertySqlDate"),
3779:                            new java.sql.Date(cal.getTime().getTime()));
3780:                    assertEquals(property_values.get("propertyTime"), new Time(
3781:                            cal.getTime().getTime()));
3782:                    assertEquals(property_values.get("propertyByte"), new Byte(
3783:                            (byte) 53));
3784:                    assertEquals(property_values.get("propertyFloat"),
3785:                            new Float(35523.967f));
3786:                    assertEquals(property_values.get("propertyShort"),
3787:                            new Short((short) 31));
3788:                } catch (BeanUtilsException e) {
3789:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3790:                }
3791:            }
3792:
3793:            public void testGetPropertyValuesIncludedPrefix() {
3794:                try {
3795:                    Map<String, Object> property_values = BeanUtils
3796:                            .getPropertyValues(getPopulatedBean(),
3797:                                    new String[] { "PREFIX:propertyReadonly",
3798:                                            "PREFIX:propertyWriteonly",
3799:                                            "PREFIX:propertyString",
3800:                                            "PREFIX:propertyDate",
3801:                                            "PREFIX:propertySqlDate",
3802:                                            "PREFIX:propertyTime",
3803:                                            "PREFIX:propertyByte",
3804:                                            "PREFIX:propertyFloat",
3805:                                            "PREFIX:propertyShort" }, null,
3806:                                    "PREFIX:");
3807:                    assertEquals(property_values.size(), 7);
3808:                    assertTrue(property_values
3809:                            .containsKey("PREFIX:propertyString"));
3810:                    assertTrue(property_values
3811:                            .containsKey("PREFIX:propertyDate"));
3812:                    assertTrue(property_values
3813:                            .containsKey("PREFIX:propertySqlDate"));
3814:                    assertTrue(property_values
3815:                            .containsKey("PREFIX:propertyTime"));
3816:                    assertTrue(property_values
3817:                            .containsKey("PREFIX:propertyByte"));
3818:                    assertTrue(property_values
3819:                            .containsKey("PREFIX:propertyFloat"));
3820:                    assertTrue(property_values
3821:                            .containsKey("PREFIX:propertyShort"));
3822:
3823:                    Calendar cal = Calendar.getInstance();
3824:                    cal.set(2002, 11, 26, 22, 52, 31);
3825:                    cal.set(Calendar.MILLISECOND, 153);
3826:                    assertEquals(property_values.get("PREFIX:propertyString"),
3827:                            "thisisastring");
3828:                    assertEquals(property_values.get("PREFIX:propertyDate"),
3829:                            cal.getTime());
3830:                    assertEquals(property_values.get("PREFIX:propertySqlDate"),
3831:                            new java.sql.Date(cal.getTime().getTime()));
3832:                    assertEquals(property_values.get("PREFIX:propertyTime"),
3833:                            new Time(cal.getTime().getTime()));
3834:                    assertEquals(property_values.get("PREFIX:propertyByte"),
3835:                            new Byte((byte) 53));
3836:                    assertEquals(property_values.get("PREFIX:propertyFloat"),
3837:                            new Float(35523.967f));
3838:                    assertEquals(property_values.get("PREFIX:propertyShort"),
3839:                            new Short((short) 31));
3840:                } catch (BeanUtilsException e) {
3841:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3842:                }
3843:            }
3844:
3845:            public void testGetPropertyValuesIncludedPrefixGetters() {
3846:                try {
3847:                    Map<String, Object> property_values = BeanUtils
3848:                            .getPropertyValues(BeanUtils.GETTERS,
3849:                                    getPopulatedBean(), new String[] {
3850:                                            "PREFIX:propertyReadonly",
3851:                                            "PREFIX:propertyWriteonly",
3852:                                            "PREFIX:propertyString",
3853:                                            "PREFIX:propertyDate",
3854:                                            "PREFIX:propertySqlDate",
3855:                                            "PREFIX:propertyTime",
3856:                                            "PREFIX:propertyByte",
3857:                                            "PREFIX:propertyFloat",
3858:                                            "PREFIX:propertyShort" }, null,
3859:                                    "PREFIX:");
3860:                    assertEquals(property_values.size(), 8);
3861:                    assertTrue(property_values
3862:                            .containsKey("PREFIX:propertyReadonly"));
3863:                    assertTrue(property_values
3864:                            .containsKey("PREFIX:propertyString"));
3865:                    assertTrue(property_values
3866:                            .containsKey("PREFIX:propertyDate"));
3867:                    assertTrue(property_values
3868:                            .containsKey("PREFIX:propertySqlDate"));
3869:                    assertTrue(property_values
3870:                            .containsKey("PREFIX:propertyTime"));
3871:                    assertTrue(property_values
3872:                            .containsKey("PREFIX:propertyByte"));
3873:                    assertTrue(property_values
3874:                            .containsKey("PREFIX:propertyFloat"));
3875:                    assertTrue(property_values
3876:                            .containsKey("PREFIX:propertyShort"));
3877:
3878:                    Calendar cal = Calendar.getInstance();
3879:                    cal.set(2002, 11, 26, 22, 52, 31);
3880:                    cal.set(Calendar.MILLISECOND, 153);
3881:                    assertEquals(
3882:                            property_values.get("PREFIX:propertyReadonly"), 23);
3883:                    assertEquals(property_values.get("PREFIX:propertyString"),
3884:                            "thisisastring");
3885:                    assertEquals(property_values.get("PREFIX:propertyDate"),
3886:                            cal.getTime());
3887:                    assertEquals(property_values.get("PREFIX:propertySqlDate"),
3888:                            new java.sql.Date(cal.getTime().getTime()));
3889:                    assertEquals(property_values.get("PREFIX:propertyTime"),
3890:                            new Time(cal.getTime().getTime()));
3891:                    assertEquals(property_values.get("PREFIX:propertyByte"),
3892:                            new Byte((byte) 53));
3893:                    assertEquals(property_values.get("PREFIX:propertyFloat"),
3894:                            new Float(35523.967f));
3895:                    assertEquals(property_values.get("PREFIX:propertyShort"),
3896:                            new Short((short) 31));
3897:                } catch (BeanUtilsException e) {
3898:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3899:                }
3900:            }
3901:
3902:            public void testGetPropertyValuesIncludedPrefixSetters() {
3903:                try {
3904:                    Map<String, Object> property_values = BeanUtils
3905:                            .getPropertyValues(BeanUtils.SETTERS,
3906:                                    getPopulatedBean(), new String[] {
3907:                                            "PREFIX:propertyReadonly",
3908:                                            "PREFIX:propertyWriteonly",
3909:                                            "PREFIX:propertyString",
3910:                                            "PREFIX:propertyDate",
3911:                                            "PREFIX:propertySqlDate",
3912:                                            "PREFIX:propertyTime",
3913:                                            "PREFIX:propertyByte",
3914:                                            "PREFIX:propertyFloat",
3915:                                            "PREFIX:propertyShort" }, null,
3916:                                    "PREFIX:");
3917:                    assertEquals(property_values.size(), 7);
3918:                    assertTrue(property_values
3919:                            .containsKey("PREFIX:propertyString"));
3920:                    assertTrue(property_values
3921:                            .containsKey("PREFIX:propertyDate"));
3922:                    assertTrue(property_values
3923:                            .containsKey("PREFIX:propertySqlDate"));
3924:                    assertTrue(property_values
3925:                            .containsKey("PREFIX:propertyTime"));
3926:                    assertTrue(property_values
3927:                            .containsKey("PREFIX:propertyByte"));
3928:                    assertTrue(property_values
3929:                            .containsKey("PREFIX:propertyFloat"));
3930:                    assertTrue(property_values
3931:                            .containsKey("PREFIX:propertyShort"));
3932:
3933:                    Calendar cal = Calendar.getInstance();
3934:                    cal.set(2002, 11, 26, 22, 52, 31);
3935:                    cal.set(Calendar.MILLISECOND, 153);
3936:                    assertEquals(property_values.get("PREFIX:propertyString"),
3937:                            "thisisastring");
3938:                    assertEquals(property_values.get("PREFIX:propertyDate"),
3939:                            cal.getTime());
3940:                    assertEquals(property_values.get("PREFIX:propertySqlDate"),
3941:                            new java.sql.Date(cal.getTime().getTime()));
3942:                    assertEquals(property_values.get("PREFIX:propertyTime"),
3943:                            new Time(cal.getTime().getTime()));
3944:                    assertEquals(property_values.get("PREFIX:propertyByte"),
3945:                            new Byte((byte) 53));
3946:                    assertEquals(property_values.get("PREFIX:propertyFloat"),
3947:                            new Float(35523.967f));
3948:                    assertEquals(property_values.get("PREFIX:propertyShort"),
3949:                            new Short((short) 31));
3950:                } catch (BeanUtilsException e) {
3951:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
3952:                }
3953:            }
3954:
3955:            public void testGetPropertyValuesExcluded() {
3956:                try {
3957:                    Map<String, Object> property_values = BeanUtils
3958:                            .getPropertyValues(getPopulatedBean(), null,
3959:                                    new String[] { "propertyString",
3960:                                            "propertyCalendar",
3961:                                            "propertySqlDate",
3962:                                            "propertyBoolean", "propertyFloat",
3963:                                            "propertyBigDecimal" }, null);
3964:                    assertEquals(property_values.size(), 10);
3965:                    assertTrue(property_values
3966:                            .containsKey("propertyStringbuffer"));
3967:                    assertTrue(property_values.containsKey("propertyDate"));
3968:                    assertTrue(property_values.containsKey("propertyTime"));
3969:                    assertTrue(property_values.containsKey("propertyTimestamp"));
3970:                    assertTrue(property_values.containsKey("propertyChar"));
3971:                    assertTrue(property_values.containsKey("propertyByte"));
3972:                    assertTrue(property_values.containsKey("propertyDouble"));
3973:                    assertTrue(property_values.containsKey("propertyInt"));
3974:                    assertTrue(property_values.containsKey("propertyLong"));
3975:                    assertTrue(property_values.containsKey("propertyShort"));
3976:
3977:                    Calendar cal = Calendar.getInstance();
3978:                    cal.set(2002, 11, 26, 22, 52, 31);
3979:                    cal.set(Calendar.MILLISECOND, 153);
3980:                    assertEquals(property_values.get("propertyStringbuffer")
3981:                            .toString(), new StringBuffer(
3982:                            "butthisisastringbuffer").toString());
3983:                    assertEquals(property_values.get("propertyDate"), cal
3984:                            .getTime());
3985:                    assertEquals(property_values.get("propertyTime"), new Time(
3986:                            cal.getTime().getTime()));
3987:                    assertEquals(property_values.get("propertyTimestamp"),
3988:                            new Timestamp(cal.getTime().getTime()));
3989:                    assertEquals(property_values.get("propertyChar"),
3990:                            new Character('g'));
3991:                    assertEquals(property_values.get("propertyByte"), new Byte(
3992:                            (byte) 53));
3993:                    assertEquals(property_values.get("propertyDouble"),
3994:                            new Double(84578.42d));
3995:                    assertEquals(property_values.get("propertyInt"),
3996:                            new Integer(978));
3997:                    assertEquals(property_values.get("propertyLong"), new Long(
3998:                            87346L));
3999:                    assertEquals(property_values.get("propertyShort"),
4000:                            new Short((short) 31));
4001:                } catch (BeanUtilsException e) {
4002:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4003:                }
4004:            }
4005:
4006:            public void testGetPropertyValuesExcludedGetters() {
4007:                try {
4008:                    Map<String, Object> property_values = BeanUtils
4009:                            .getPropertyValues(BeanUtils.GETTERS,
4010:                                    getPopulatedBean(), null, new String[] {
4011:                                            "propertyString",
4012:                                            "propertyCalendar",
4013:                                            "propertySqlDate",
4014:                                            "propertyBoolean", "propertyFloat",
4015:                                            "propertyBigDecimal" }, null);
4016:                    assertEquals(property_values.size(), 11);
4017:                    assertTrue(property_values.containsKey("propertyReadonly"));
4018:                    assertTrue(property_values
4019:                            .containsKey("propertyStringbuffer"));
4020:                    assertTrue(property_values.containsKey("propertyDate"));
4021:                    assertTrue(property_values.containsKey("propertyTime"));
4022:                    assertTrue(property_values.containsKey("propertyTimestamp"));
4023:                    assertTrue(property_values.containsKey("propertyChar"));
4024:                    assertTrue(property_values.containsKey("propertyByte"));
4025:                    assertTrue(property_values.containsKey("propertyDouble"));
4026:                    assertTrue(property_values.containsKey("propertyInt"));
4027:                    assertTrue(property_values.containsKey("propertyLong"));
4028:                    assertTrue(property_values.containsKey("propertyShort"));
4029:
4030:                    Calendar cal = Calendar.getInstance();
4031:                    cal.set(2002, 11, 26, 22, 52, 31);
4032:                    cal.set(Calendar.MILLISECOND, 153);
4033:                    assertEquals(property_values.get("propertyReadonly"), 23);
4034:                    assertEquals(property_values.get("propertyStringbuffer")
4035:                            .toString(), new StringBuffer(
4036:                            "butthisisastringbuffer").toString());
4037:                    assertEquals(property_values.get("propertyDate"), cal
4038:                            .getTime());
4039:                    assertEquals(property_values.get("propertyTime"), new Time(
4040:                            cal.getTime().getTime()));
4041:                    assertEquals(property_values.get("propertyTimestamp"),
4042:                            new Timestamp(cal.getTime().getTime()));
4043:                    assertEquals(property_values.get("propertyChar"),
4044:                            new Character('g'));
4045:                    assertEquals(property_values.get("propertyByte"), new Byte(
4046:                            (byte) 53));
4047:                    assertEquals(property_values.get("propertyDouble"),
4048:                            new Double(84578.42d));
4049:                    assertEquals(property_values.get("propertyInt"),
4050:                            new Integer(978));
4051:                    assertEquals(property_values.get("propertyLong"), new Long(
4052:                            87346L));
4053:                    assertEquals(property_values.get("propertyShort"),
4054:                            new Short((short) 31));
4055:                } catch (BeanUtilsException e) {
4056:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4057:                }
4058:            }
4059:
4060:            public void testGetPropertyValuesExcludedSetters() {
4061:                try {
4062:                    Map<String, Object> property_values = BeanUtils
4063:                            .getPropertyValues(BeanUtils.SETTERS,
4064:                                    getPopulatedBean(), null, new String[] {
4065:                                            "propertyString",
4066:                                            "propertyCalendar",
4067:                                            "propertySqlDate",
4068:                                            "propertyBoolean", "propertyFloat",
4069:                                            "propertyBigDecimal" }, null);
4070:                    assertEquals(property_values.size(), 10);
4071:                    assertTrue(property_values
4072:                            .containsKey("propertyStringbuffer"));
4073:                    assertTrue(property_values.containsKey("propertyDate"));
4074:                    assertTrue(property_values.containsKey("propertyTime"));
4075:                    assertTrue(property_values.containsKey("propertyTimestamp"));
4076:                    assertTrue(property_values.containsKey("propertyChar"));
4077:                    assertTrue(property_values.containsKey("propertyByte"));
4078:                    assertTrue(property_values.containsKey("propertyDouble"));
4079:                    assertTrue(property_values.containsKey("propertyInt"));
4080:                    assertTrue(property_values.containsKey("propertyLong"));
4081:                    assertTrue(property_values.containsKey("propertyShort"));
4082:
4083:                    Calendar cal = Calendar.getInstance();
4084:                    cal.set(2002, 11, 26, 22, 52, 31);
4085:                    cal.set(Calendar.MILLISECOND, 153);
4086:                    assertEquals(property_values.get("propertyStringbuffer")
4087:                            .toString(), new StringBuffer(
4088:                            "butthisisastringbuffer").toString());
4089:                    assertEquals(property_values.get("propertyDate"), cal
4090:                            .getTime());
4091:                    assertEquals(property_values.get("propertyTime"), new Time(
4092:                            cal.getTime().getTime()));
4093:                    assertEquals(property_values.get("propertyTimestamp"),
4094:                            new Timestamp(cal.getTime().getTime()));
4095:                    assertEquals(property_values.get("propertyChar"),
4096:                            new Character('g'));
4097:                    assertEquals(property_values.get("propertyByte"), new Byte(
4098:                            (byte) 53));
4099:                    assertEquals(property_values.get("propertyDouble"),
4100:                            new Double(84578.42d));
4101:                    assertEquals(property_values.get("propertyInt"),
4102:                            new Integer(978));
4103:                    assertEquals(property_values.get("propertyLong"), new Long(
4104:                            87346L));
4105:                    assertEquals(property_values.get("propertyShort"),
4106:                            new Short((short) 31));
4107:                } catch (BeanUtilsException e) {
4108:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4109:                }
4110:            }
4111:
4112:            public void testGetPropertyValuesExcludedPrefix() {
4113:                try {
4114:                    Map<String, Object> property_values = BeanUtils
4115:                            .getPropertyValues(getPopulatedBean(), null,
4116:                                    new String[] { "PREFIX:propertyString",
4117:                                            "PREFIX:propertyCalendar",
4118:                                            "PREFIX:propertySqlDate",
4119:                                            "PREFIX:propertyBoolean",
4120:                                            "PREFIX:propertyFloat",
4121:                                            "PREFIX:propertyBigDecimal" },
4122:                                    "PREFIX:");
4123:                    assertEquals(property_values.size(), 10);
4124:                    assertTrue(property_values
4125:                            .containsKey("PREFIX:propertyStringbuffer"));
4126:                    assertTrue(property_values
4127:                            .containsKey("PREFIX:propertyDate"));
4128:                    assertTrue(property_values
4129:                            .containsKey("PREFIX:propertyTime"));
4130:                    assertTrue(property_values
4131:                            .containsKey("PREFIX:propertyTimestamp"));
4132:                    assertTrue(property_values
4133:                            .containsKey("PREFIX:propertyChar"));
4134:                    assertTrue(property_values
4135:                            .containsKey("PREFIX:propertyByte"));
4136:                    assertTrue(property_values
4137:                            .containsKey("PREFIX:propertyDouble"));
4138:                    assertTrue(property_values
4139:                            .containsKey("PREFIX:propertyInt"));
4140:                    assertTrue(property_values
4141:                            .containsKey("PREFIX:propertyLong"));
4142:                    assertTrue(property_values
4143:                            .containsKey("PREFIX:propertyShort"));
4144:
4145:                    Calendar cal = Calendar.getInstance();
4146:                    cal.set(2002, 11, 26, 22, 52, 31);
4147:                    cal.set(Calendar.MILLISECOND, 153);
4148:                    assertEquals(property_values.get(
4149:                            "PREFIX:propertyStringbuffer").toString(),
4150:                            new StringBuffer("butthisisastringbuffer")
4151:                                    .toString());
4152:                    assertEquals(property_values.get("PREFIX:propertyDate"),
4153:                            cal.getTime());
4154:                    assertEquals(property_values.get("PREFIX:propertyTime"),
4155:                            new Time(cal.getTime().getTime()));
4156:                    assertEquals(property_values
4157:                            .get("PREFIX:propertyTimestamp"), new Timestamp(cal
4158:                            .getTime().getTime()));
4159:                    assertEquals(property_values.get("PREFIX:propertyChar"),
4160:                            new Character('g'));
4161:                    assertEquals(property_values.get("PREFIX:propertyByte"),
4162:                            new Byte((byte) 53));
4163:                    assertEquals(property_values.get("PREFIX:propertyDouble"),
4164:                            new Double(84578.42d));
4165:                    assertEquals(property_values.get("PREFIX:propertyInt"),
4166:                            new Integer(978));
4167:                    assertEquals(property_values.get("PREFIX:propertyLong"),
4168:                            new Long(87346L));
4169:                    assertEquals(property_values.get("PREFIX:propertyShort"),
4170:                            new Short((short) 31));
4171:                } catch (BeanUtilsException e) {
4172:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4173:                }
4174:            }
4175:
4176:            public void testGetPropertyValuesExcludedPrefixGetters() {
4177:                try {
4178:                    Map<String, Object> property_values = BeanUtils
4179:                            .getPropertyValues(BeanUtils.GETTERS,
4180:                                    getPopulatedBean(), null, new String[] {
4181:                                            "PREFIX:propertyString",
4182:                                            "PREFIX:propertyCalendar",
4183:                                            "PREFIX:propertySqlDate",
4184:                                            "PREFIX:propertyBoolean",
4185:                                            "PREFIX:propertyFloat",
4186:                                            "PREFIX:propertyBigDecimal" },
4187:                                    "PREFIX:");
4188:                    assertEquals(property_values.size(), 11);
4189:                    assertTrue(property_values
4190:                            .containsKey("PREFIX:propertyReadonly"));
4191:                    assertTrue(property_values
4192:                            .containsKey("PREFIX:propertyStringbuffer"));
4193:                    assertTrue(property_values
4194:                            .containsKey("PREFIX:propertyDate"));
4195:                    assertTrue(property_values
4196:                            .containsKey("PREFIX:propertyTime"));
4197:                    assertTrue(property_values
4198:                            .containsKey("PREFIX:propertyTimestamp"));
4199:                    assertTrue(property_values
4200:                            .containsKey("PREFIX:propertyChar"));
4201:                    assertTrue(property_values
4202:                            .containsKey("PREFIX:propertyByte"));
4203:                    assertTrue(property_values
4204:                            .containsKey("PREFIX:propertyDouble"));
4205:                    assertTrue(property_values
4206:                            .containsKey("PREFIX:propertyInt"));
4207:                    assertTrue(property_values
4208:                            .containsKey("PREFIX:propertyLong"));
4209:                    assertTrue(property_values
4210:                            .containsKey("PREFIX:propertyShort"));
4211:
4212:                    Calendar cal = Calendar.getInstance();
4213:                    cal.set(2002, 11, 26, 22, 52, 31);
4214:                    cal.set(Calendar.MILLISECOND, 153);
4215:                    assertEquals(
4216:                            property_values.get("PREFIX:propertyReadonly"), 23);
4217:                    assertEquals(property_values.get(
4218:                            "PREFIX:propertyStringbuffer").toString(),
4219:                            new StringBuffer("butthisisastringbuffer")
4220:                                    .toString());
4221:                    assertEquals(property_values.get("PREFIX:propertyDate"),
4222:                            cal.getTime());
4223:                    assertEquals(property_values.get("PREFIX:propertyTime"),
4224:                            new Time(cal.getTime().getTime()));
4225:                    assertEquals(property_values
4226:                            .get("PREFIX:propertyTimestamp"), new Timestamp(cal
4227:                            .getTime().getTime()));
4228:                    assertEquals(property_values.get("PREFIX:propertyChar"),
4229:                            new Character('g'));
4230:                    assertEquals(property_values.get("PREFIX:propertyByte"),
4231:                            new Byte((byte) 53));
4232:                    assertEquals(property_values.get("PREFIX:propertyDouble"),
4233:                            new Double(84578.42d));
4234:                    assertEquals(property_values.get("PREFIX:propertyInt"),
4235:                            new Integer(978));
4236:                    assertEquals(property_values.get("PREFIX:propertyLong"),
4237:                            new Long(87346L));
4238:                    assertEquals(property_values.get("PREFIX:propertyShort"),
4239:                            new Short((short) 31));
4240:                } catch (BeanUtilsException e) {
4241:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4242:                }
4243:            }
4244:
4245:            public void testGetPropertyValuesExcludedPrefixSetters() {
4246:                try {
4247:                    Map<String, Object> property_values = BeanUtils
4248:                            .getPropertyValues(BeanUtils.SETTERS,
4249:                                    getPopulatedBean(), null, new String[] {
4250:                                            "PREFIX:propertyString",
4251:                                            "PREFIX:propertyCalendar",
4252:                                            "PREFIX:propertySqlDate",
4253:                                            "PREFIX:propertyBoolean",
4254:                                            "PREFIX:propertyFloat",
4255:                                            "PREFIX:propertyBigDecimal" },
4256:                                    "PREFIX:");
4257:                    assertEquals(property_values.size(), 10);
4258:                    assertTrue(property_values
4259:                            .containsKey("PREFIX:propertyStringbuffer"));
4260:                    assertTrue(property_values
4261:                            .containsKey("PREFIX:propertyDate"));
4262:                    assertTrue(property_values
4263:                            .containsKey("PREFIX:propertyTime"));
4264:                    assertTrue(property_values
4265:                            .containsKey("PREFIX:propertyTimestamp"));
4266:                    assertTrue(property_values
4267:                            .containsKey("PREFIX:propertyChar"));
4268:                    assertTrue(property_values
4269:                            .containsKey("PREFIX:propertyByte"));
4270:                    assertTrue(property_values
4271:                            .containsKey("PREFIX:propertyDouble"));
4272:                    assertTrue(property_values
4273:                            .containsKey("PREFIX:propertyInt"));
4274:                    assertTrue(property_values
4275:                            .containsKey("PREFIX:propertyLong"));
4276:                    assertTrue(property_values
4277:                            .containsKey("PREFIX:propertyShort"));
4278:
4279:                    Calendar cal = Calendar.getInstance();
4280:                    cal.set(2002, 11, 26, 22, 52, 31);
4281:                    cal.set(Calendar.MILLISECOND, 153);
4282:                    assertEquals(property_values.get(
4283:                            "PREFIX:propertyStringbuffer").toString(),
4284:                            new StringBuffer("butthisisastringbuffer")
4285:                                    .toString());
4286:                    assertEquals(property_values.get("PREFIX:propertyDate"),
4287:                            cal.getTime());
4288:                    assertEquals(property_values.get("PREFIX:propertyTime"),
4289:                            new Time(cal.getTime().getTime()));
4290:                    assertEquals(property_values
4291:                            .get("PREFIX:propertyTimestamp"), new Timestamp(cal
4292:                            .getTime().getTime()));
4293:                    assertEquals(property_values.get("PREFIX:propertyChar"),
4294:                            new Character('g'));
4295:                    assertEquals(property_values.get("PREFIX:propertyByte"),
4296:                            new Byte((byte) 53));
4297:                    assertEquals(property_values.get("PREFIX:propertyDouble"),
4298:                            new Double(84578.42d));
4299:                    assertEquals(property_values.get("PREFIX:propertyInt"),
4300:                            new Integer(978));
4301:                    assertEquals(property_values.get("PREFIX:propertyLong"),
4302:                            new Long(87346L));
4303:                    assertEquals(property_values.get("PREFIX:propertyShort"),
4304:                            new Short((short) 31));
4305:                } catch (BeanUtilsException e) {
4306:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4307:                }
4308:            }
4309:
4310:            public void testGetPropertyValuesFiltered() {
4311:                try {
4312:                    Map<String, Object> property_values = BeanUtils
4313:                            .getPropertyValues(getPopulatedBean(),
4314:                                    new String[] { "propertyReadonly",
4315:                                            "propertyWriteonly",
4316:                                            "propertyString", "propertyDate",
4317:                                            "propertySqlDate", "propertyTime",
4318:                                            "propertyByte", "propertyFloat",
4319:                                            "propertyShort" }, new String[] {
4320:                                            "propertyString",
4321:                                            "propertyCalendar",
4322:                                            "propertySqlDate",
4323:                                            "propertyBoolean", "propertyFloat",
4324:                                            "propertyBigDecimal" }, null);
4325:                    assertEquals(property_values.size(), 4);
4326:                    assertTrue(property_values.containsKey("propertyDate"));
4327:                    assertTrue(property_values.containsKey("propertyTime"));
4328:                    assertTrue(property_values.containsKey("propertyByte"));
4329:                    assertTrue(property_values.containsKey("propertyShort"));
4330:
4331:                    Calendar cal = Calendar.getInstance();
4332:                    cal.set(2002, 11, 26, 22, 52, 31);
4333:                    cal.set(Calendar.MILLISECOND, 153);
4334:                    assertEquals(property_values.get("propertyDate"), cal
4335:                            .getTime());
4336:                    assertEquals(property_values.get("propertyTime"), new Time(
4337:                            cal.getTime().getTime()));
4338:                    assertEquals(property_values.get("propertyByte"), new Byte(
4339:                            (byte) 53));
4340:                    assertEquals(property_values.get("propertyShort"),
4341:                            new Short((short) 31));
4342:                } catch (BeanUtilsException e) {
4343:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4344:                }
4345:            }
4346:
4347:            public void testGetPropertyValuesFilteredGetters() {
4348:                try {
4349:                    Map<String, Object> property_values = BeanUtils
4350:                            .getPropertyValues(BeanUtils.GETTERS,
4351:                                    getPopulatedBean(), new String[] {
4352:                                            "propertyReadonly",
4353:                                            "propertyWriteonly",
4354:                                            "propertyString", "propertyDate",
4355:                                            "propertySqlDate", "propertyTime",
4356:                                            "propertyByte", "propertyFloat",
4357:                                            "propertyShort" }, new String[] {
4358:                                            "propertyString",
4359:                                            "propertyCalendar",
4360:                                            "propertySqlDate",
4361:                                            "propertyBoolean", "propertyFloat",
4362:                                            "propertyBigDecimal" }, null);
4363:                    assertEquals(property_values.size(), 5);
4364:                    assertTrue(property_values.containsKey("propertyReadonly"));
4365:                    assertTrue(property_values.containsKey("propertyDate"));
4366:                    assertTrue(property_values.containsKey("propertyTime"));
4367:                    assertTrue(property_values.containsKey("propertyByte"));
4368:                    assertTrue(property_values.containsKey("propertyShort"));
4369:
4370:                    Calendar cal = Calendar.getInstance();
4371:                    cal.set(2002, 11, 26, 22, 52, 31);
4372:                    cal.set(Calendar.MILLISECOND, 153);
4373:                    assertEquals(property_values.get("propertyReadonly"), 23);
4374:                    assertEquals(property_values.get("propertyDate"), cal
4375:                            .getTime());
4376:                    assertEquals(property_values.get("propertyTime"), new Time(
4377:                            cal.getTime().getTime()));
4378:                    assertEquals(property_values.get("propertyByte"), new Byte(
4379:                            (byte) 53));
4380:                    assertEquals(property_values.get("propertyShort"),
4381:                            new Short((short) 31));
4382:                } catch (BeanUtilsException e) {
4383:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4384:                }
4385:            }
4386:
4387:            public void testGetPropertyValuesFilteredSetters() {
4388:                try {
4389:                    Map<String, Object> property_values = BeanUtils
4390:                            .getPropertyValues(BeanUtils.SETTERS,
4391:                                    getPopulatedBean(), new String[] {
4392:                                            "propertyReadonly",
4393:                                            "propertyWriteonly",
4394:                                            "propertyString", "propertyDate",
4395:                                            "propertySqlDate", "propertyTime",
4396:                                            "propertyByte", "propertyFloat",
4397:                                            "propertyShort" }, new String[] {
4398:                                            "propertyString",
4399:                                            "propertyCalendar",
4400:                                            "propertySqlDate",
4401:                                            "propertyBoolean", "propertyFloat",
4402:                                            "propertyBigDecimal" }, null);
4403:                    assertEquals(property_values.size(), 4);
4404:                    assertTrue(property_values.containsKey("propertyDate"));
4405:                    assertTrue(property_values.containsKey("propertyTime"));
4406:                    assertTrue(property_values.containsKey("propertyByte"));
4407:                    assertTrue(property_values.containsKey("propertyShort"));
4408:
4409:                    Calendar cal = Calendar.getInstance();
4410:                    cal.set(2002, 11, 26, 22, 52, 31);
4411:                    cal.set(Calendar.MILLISECOND, 153);
4412:                    assertEquals(property_values.get("propertyDate"), cal
4413:                            .getTime());
4414:                    assertEquals(property_values.get("propertyTime"), new Time(
4415:                            cal.getTime().getTime()));
4416:                    assertEquals(property_values.get("propertyByte"), new Byte(
4417:                            (byte) 53));
4418:                    assertEquals(property_values.get("propertyShort"),
4419:                            new Short((short) 31));
4420:                } catch (BeanUtilsException e) {
4421:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4422:                }
4423:            }
4424:
4425:            public void testGetPropertyValuesFilteredPrefix() {
4426:                try {
4427:                    Map<String, Object> property_values = BeanUtils
4428:                            .getPropertyValues(getPopulatedBean(),
4429:                                    new String[] { "PREFIX:propertyReadonly",
4430:                                            "PREFIX:propertyWriteonly",
4431:                                            "PREFIX:propertyString",
4432:                                            "PREFIX:propertyDate",
4433:                                            "PREFIX:propertySqlDate",
4434:                                            "PREFIX:propertyTime",
4435:                                            "PREFIX:propertyByte",
4436:                                            "PREFIX:propertyFloat",
4437:                                            "PREFIX:propertyShort" },
4438:                                    new String[] { "PREFIX:propertyString",
4439:                                            "PREFIX:propertyCalendar",
4440:                                            "PREFIX:propertySqlDate",
4441:                                            "PREFIX:propertyBoolean",
4442:                                            "PREFIX:propertyFloat",
4443:                                            "PREFIX:propertyBigDecimal" },
4444:                                    "PREFIX:");
4445:                    assertEquals(property_values.size(), 4);
4446:                    assertTrue(property_values
4447:                            .containsKey("PREFIX:propertyDate"));
4448:                    assertTrue(property_values
4449:                            .containsKey("PREFIX:propertyTime"));
4450:                    assertTrue(property_values
4451:                            .containsKey("PREFIX:propertyByte"));
4452:                    assertTrue(property_values
4453:                            .containsKey("PREFIX:propertyShort"));
4454:
4455:                    Calendar cal = Calendar.getInstance();
4456:                    cal.set(2002, 11, 26, 22, 52, 31);
4457:                    cal.set(Calendar.MILLISECOND, 153);
4458:                    assertEquals(property_values.get("PREFIX:propertyDate"),
4459:                            cal.getTime());
4460:                    assertEquals(property_values.get("PREFIX:propertyTime"),
4461:                            new Time(cal.getTime().getTime()));
4462:                    assertEquals(property_values.get("PREFIX:propertyByte"),
4463:                            new Byte((byte) 53));
4464:                    assertEquals(property_values.get("PREFIX:propertyShort"),
4465:                            new Short((short) 31));
4466:                } catch (BeanUtilsException e) {
4467:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4468:                }
4469:            }
4470:
4471:            public void testGetPropertyValuesFilteredPrefixGetters() {
4472:                try {
4473:                    Map<String, Object> property_values = BeanUtils
4474:                            .getPropertyValues(BeanUtils.GETTERS,
4475:                                    getPopulatedBean(), new String[] {
4476:                                            "PREFIX:propertyReadonly",
4477:                                            "PREFIX:propertyWriteonly",
4478:                                            "PREFIX:propertyString",
4479:                                            "PREFIX:propertyDate",
4480:                                            "PREFIX:propertySqlDate",
4481:                                            "PREFIX:propertyTime",
4482:                                            "PREFIX:propertyByte",
4483:                                            "PREFIX:propertyFloat",
4484:                                            "PREFIX:propertyShort" },
4485:                                    new String[] { "PREFIX:propertyString",
4486:                                            "PREFIX:propertyCalendar",
4487:                                            "PREFIX:propertySqlDate",
4488:                                            "PREFIX:propertyBoolean",
4489:                                            "PREFIX:propertyFloat",
4490:                                            "PREFIX:propertyBigDecimal" },
4491:                                    "PREFIX:");
4492:                    assertEquals(property_values.size(), 5);
4493:                    assertTrue(property_values
4494:                            .containsKey("PREFIX:propertyReadonly"));
4495:                    assertTrue(property_values
4496:                            .containsKey("PREFIX:propertyDate"));
4497:                    assertTrue(property_values
4498:                            .containsKey("PREFIX:propertyTime"));
4499:                    assertTrue(property_values
4500:                            .containsKey("PREFIX:propertyByte"));
4501:                    assertTrue(property_values
4502:                            .containsKey("PREFIX:propertyShort"));
4503:
4504:                    Calendar cal = Calendar.getInstance();
4505:                    cal.set(2002, 11, 26, 22, 52, 31);
4506:                    cal.set(Calendar.MILLISECOND, 153);
4507:                    assertEquals(
4508:                            property_values.get("PREFIX:propertyReadonly"), 23);
4509:                    assertEquals(property_values.get("PREFIX:propertyDate"),
4510:                            cal.getTime());
4511:                    assertEquals(property_values.get("PREFIX:propertyTime"),
4512:                            new Time(cal.getTime().getTime()));
4513:                    assertEquals(property_values.get("PREFIX:propertyByte"),
4514:                            new Byte((byte) 53));
4515:                    assertEquals(property_values.get("PREFIX:propertyShort"),
4516:                            new Short((short) 31));
4517:                } catch (BeanUtilsException e) {
4518:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4519:                }
4520:            }
4521:
4522:            public void testGetPropertyValuesFilteredPrefixSetters() {
4523:                try {
4524:                    Map<String, Object> property_values = BeanUtils
4525:                            .getPropertyValues(BeanUtils.SETTERS,
4526:                                    getPopulatedBean(), new String[] {
4527:                                            "PREFIX:propertyReadonly",
4528:                                            "PREFIX:propertyWriteonly",
4529:                                            "PREFIX:propertyString",
4530:                                            "PREFIX:propertyDate",
4531:                                            "PREFIX:propertySqlDate",
4532:                                            "PREFIX:propertyTime",
4533:                                            "PREFIX:propertyByte",
4534:                                            "PREFIX:propertyFloat",
4535:                                            "PREFIX:propertyShort" },
4536:                                    new String[] { "PREFIX:propertyString",
4537:                                            "PREFIX:propertyCalendar",
4538:                                            "PREFIX:propertySqlDate",
4539:                                            "PREFIX:propertyBoolean",
4540:                                            "PREFIX:propertyFloat",
4541:                                            "PREFIX:propertyBigDecimal" },
4542:                                    "PREFIX:");
4543:                    assertEquals(property_values.size(), 4);
4544:                    assertTrue(property_values
4545:                            .containsKey("PREFIX:propertyDate"));
4546:                    assertTrue(property_values
4547:                            .containsKey("PREFIX:propertyTime"));
4548:                    assertTrue(property_values
4549:                            .containsKey("PREFIX:propertyByte"));
4550:                    assertTrue(property_values
4551:                            .containsKey("PREFIX:propertyShort"));
4552:
4553:                    Calendar cal = Calendar.getInstance();
4554:                    cal.set(2002, 11, 26, 22, 52, 31);
4555:                    cal.set(Calendar.MILLISECOND, 153);
4556:                    assertEquals(property_values.get("PREFIX:propertyDate"),
4557:                            cal.getTime());
4558:                    assertEquals(property_values.get("PREFIX:propertyTime"),
4559:                            new Time(cal.getTime().getTime()));
4560:                    assertEquals(property_values.get("PREFIX:propertyByte"),
4561:                            new Byte((byte) 53));
4562:                    assertEquals(property_values.get("PREFIX:propertyShort"),
4563:                            new Short((short) 31));
4564:                } catch (BeanUtilsException e) {
4565:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
4566:                }
4567:            }
4568:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.