Source Code Cross Referenced for StandardStringifierTest.java in  » Net » Terracotta » com » tc » util » 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 » Net » Terracotta » com.tc.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice.  All rights reserved.
003:         */
004:        package com.tc.util;
005:
006:        import com.tc.test.TCTestCase;
007:
008:        /**
009:         * Unit test for {@link StandardStringifier}.
010:         */
011:        public class StandardStringifierTest extends TCTestCase {
012:
013:            private StandardStringifier stringifier;
014:
015:            public void setUp() {
016:                this .stringifier = StandardStringifier.INSTANCE;
017:            }
018:
019:            public void testNull() throws Exception {
020:                assertEquals("<null>", stringifier.toString(null));
021:            }
022:
023:            private static class MyObj {
024:                private final String value;
025:
026:                public MyObj(String value) {
027:                    this .value = value;
028:                }
029:
030:                public String toString() {
031:                    return this .value;
032:                }
033:            }
034:
035:            public void testObject() throws Exception {
036:                assertEquals("FOOBAR", stringifier
037:                        .toString(new MyObj("FOOBAR")));
038:            }
039:
040:            public void testObjectArray() throws Exception {
041:                assertEquals("Object[3]: FOOBAR, barbaz, FOOFLE", stringifier
042:                        .toString(new Object[] { new MyObj("FOOBAR"),
043:                                new MyObj("barbaz"), new MyObj("FOOFLE") }));
044:                assertEquals(
045:                        "Object[22]: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...",
046:                        stringifier.toString(new Object[] { new MyObj("1"),
047:                                new MyObj("2"), new MyObj("3"), new MyObj("4"),
048:                                new MyObj("5"), new MyObj("6"), new MyObj("7"),
049:                                new MyObj("8"), new MyObj("9"),
050:                                new MyObj("10"), new MyObj("11"),
051:                                new MyObj("12"), new MyObj("13"),
052:                                new MyObj("14"), new MyObj("15"),
053:                                new MyObj("16"), new MyObj("17"),
054:                                new MyObj("18"), new MyObj("19"),
055:                                new MyObj("20"), new MyObj("21"),
056:                                new MyObj("22") }));
057:            }
058:
059:            public void testOurObjectArray() throws Exception {
060:                assertEquals(
061:                        "StandardStringifierTest.MyObj[3]: FOOBAR, barbaz, FOOFLE",
062:                        stringifier.toString(new MyObj[] { new MyObj("FOOBAR"),
063:                                new MyObj("barbaz"), new MyObj("FOOFLE") }));
064:                assertEquals(
065:                        "StandardStringifierTest.MyObj[22]: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...",
066:                        stringifier.toString(new MyObj[] { new MyObj("1"),
067:                                new MyObj("2"), new MyObj("3"), new MyObj("4"),
068:                                new MyObj("5"), new MyObj("6"), new MyObj("7"),
069:                                new MyObj("8"), new MyObj("9"),
070:                                new MyObj("10"), new MyObj("11"),
071:                                new MyObj("12"), new MyObj("13"),
072:                                new MyObj("14"), new MyObj("15"),
073:                                new MyObj("16"), new MyObj("17"),
074:                                new MyObj("18"), new MyObj("19"),
075:                                new MyObj("20"), new MyObj("21"),
076:                                new MyObj("22") }));
077:            }
078:
079:            public void testByteArray() throws Exception {
080:                assertEquals("3 bytes: 0102 03  ...", stringifier
081:                        .toString(new byte[] { 1, 2, 3 }));
082:            }
083:
084:            public void testShortArray() throws Exception {
085:                assertEquals("short[3]: 1, 2, 3", stringifier
086:                        .toString(new short[] { 1, 2, 3 }));
087:                assertEquals(
088:                        "short[22]: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...",
089:                        stringifier.toString(new short[] { 1, 2, 3, 4, 5, 6, 7,
090:                                8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
091:                                20, 21, 22 }));
092:            }
093:
094:            public void testIntArray() throws Exception {
095:                assertEquals("int[3]: 1, 2, 3", stringifier.toString(new int[] {
096:                        1, 2, 3 }));
097:                assertEquals(
098:                        "int[22]: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...",
099:                        stringifier.toString(new int[] { 1, 2, 3, 4, 5, 6, 7,
100:                                8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
101:                                20, 21, 22 }));
102:            }
103:
104:            public void testLongArray() throws Exception {
105:                assertEquals("long[3]: 1, 2, 3", stringifier
106:                        .toString(new long[] { 1, 2, 3 }));
107:                assertEquals(
108:                        "long[22]: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...",
109:                        stringifier.toString(new long[] { 1, 2, 3, 4, 5, 6, 7,
110:                                8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
111:                                20, 21, 22 }));
112:            }
113:
114:            public void testCharArray() throws Exception {
115:                assertEquals("char[3]: 1, 2, 3", stringifier
116:                        .toString(new char[] { '1', '2', '3' }));
117:                assertEquals(
118:                        "char[22]: 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, ...",
119:                        stringifier.toString(new char[] { '1', '2', '3', '4',
120:                                '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
121:                                'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm' }));
122:            }
123:
124:            public void testBooleanArray() throws Exception {
125:                assertEquals("boolean[3]: true, false, true", stringifier
126:                        .toString(new boolean[] { true, false, true }));
127:                assertEquals(
128:                        "boolean[22]: true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, ...",
129:                        stringifier.toString(new boolean[] { true, false, true,
130:                                false, true, false, true, false, true, false,
131:                                true, false, true, false, true, false, true,
132:                                false, true, false, true, false }));
133:            }
134:
135:            public void testFloatArray() throws Exception {
136:                assertEquals("float[3]: 1.0, 2.0, 3.0", stringifier
137:                        .toString(new float[] { 1.0f, 2.0f, 3.0f }));
138:                assertEquals(
139:                        "float[22]: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, ...",
140:                        stringifier.toString(new float[] { 1.0f, 2.0f, 3.0f,
141:                                4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f,
142:                                11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f,
143:                                17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f }));
144:            }
145:
146:            public void testDoubleArray() throws Exception {
147:                assertEquals("double[3]: 1.0, 2.0, 3.0", stringifier
148:                        .toString(new double[] { 1.0, 2.0, 3.0 }));
149:                assertEquals(
150:                        "double[22]: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, ...",
151:                        stringifier.toString(new double[] { 1.0, 2.0, 3.0, 4.0,
152:                                5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
153:                                13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
154:                                21.0, 22.0 }));
155:            }
156:
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.