Source Code Cross Referenced for ModuleTestSample.java in  » Internationalization-Localization » icu4j » com » ibm » icu » dev » test » sample » 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 » Internationalization Localization » icu4j » com.ibm.icu.dev.test.sample 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *******************************************************************************
003:         * Copyright (C) 2001-2006, International Business Machines Corporation and    *
004:         * others. All Rights Reserved.                                                *
005:         *******************************************************************************
006:         */package com.ibm.icu.dev.test.sample;
007:
008:        import com.ibm.icu.dev.test.ModuleTest;
009:
010:        public class ModuleTestSample extends ModuleTest {
011:            public static void main(String[] args) throws Exception {
012:                new ModuleTestSample().run(args);
013:            }
014:
015:            ModuleTestSample() {
016:                super ("com/ibm/icu/dev/data/testdata/", "Test");
017:            }
018:
019:            // standard loop, settings and cases
020:            //    public void Test01() {
021:            //    while (nextSettings()) {
022:            //        logln("--------");
023:            //        logln("String: " + settings.getString("aString"));
024:            //        if (settings.isDefined("anInt")) {
025:            //        logln("Int: " + settings.getInt("anInt"));
026:            //        }
027:            //        logln("Boolean: " + settings.getBoolean("aBoolean"));
028:            //
029:            //        while (nextCase()) {
030:            //        logln("  ----");
031:            //        logln("  StringArray: " + printArray(testcase.getStringArray("aStringArray")));
032:            //        logln("  IntArray: " + printArray(testcase.getIntArray("anIntArray")));
033:            //        logln("  BooleanArray: " + printArray(testcase.getBooleanArray("aBooleanArray")));
034:            //        }
035:            //    }
036:            //    }
037:            //
038:            //    // loop with just cases
039:            //    public void Test02() {
040:            //    while (nextCase()) {
041:            //        logln("----");
042:            //        logln("String: " + testcase.getString("aString"));
043:            //        logln("Int: " + testcase.getInt("anInt"));
044:            //        logln("Boolean: " + testcase.getBoolean("aBoolean"));
045:            //    }
046:            //    }
047:
048:            // no cases, just uses info for test
049:            public void Test03() {
050:                //    DataMap info = testInfo();
051:                //    if (info != null) {
052:                ////        logln(info.getString(TestDataModule.DESCRIPTION)); // standard
053:                //        logln(info.getString("Extra")); // test-specific
054:                //    }
055:                //    return;
056:            }
057:
058:            // no data, ModuleTest should not allow this to execute by default
059:            public void Test04() {
060:                errln("Test04 should not execute!");
061:            }
062:
063:            // special override of validateMethod allows Test05 
064:            // to execute even though it has no data in the module
065:            protected boolean validateMethod(String methodName) {
066:                return methodName.equals("Test05") ? true : super 
067:                        .validateMethod(methodName);
068:            }
069:
070:            // no data, but override of validateMethod allows it to execute
071:            public void Test05() {
072:                logln("Test05 executed.");
073:            }
074:
075:            //    // The test data contains an error in the third case.  When getInt("Data") is
076:            //    // executed the error is logged and iteration stops.
077:            //    public void Test06() {
078:            //    while (nextCase()) {
079:            //        logln("----");
080:            //        logln("isGood: " + testcase.getString("IsGood"));
081:            //        logln("  Data: " + testcase.getInt("Data"));
082:            //    }
083:            //    }
084:            //
085:            //    // The test using the data reports an error, which also automatically stops iteration.
086:            //    public void Test07() {
087:            //    while (nextSettings()) {
088:            //        int value = settings.getInt("Value");
089:            //        while (nextCase()) {
090:            //        int factor = testcase.getInt("Factor");
091:            //        float result = (float)value / factor;
092:            //        if (result != (int)result) {
093:            //            errln("the number '" + factor + "' is not a factor of the number '" + value + "'");
094:            //        } else {
095:            //            logln("'" + factor + "' is a factor of '" + value + "'");
096:            //        }
097:            //        }
098:            //    }
099:            //    }
100:
101:            //    // The number of data elements is incorrect
102:            //    public void Test08() {
103:            //    while (nextCase()) {
104:            //        int one = testcase.getInt("One");
105:            //        int two = testcase.getInt("Two");
106:            //        int three = testcase.getInt("Three");
107:            //        logln("got: " + one + ", " + two + ", " + three);
108:            //    }
109:            //    }
110:            //
111:            //    public void Test09() {
112:            //        while (nextCase()) {
113:            //            int radix = testcase.getInt("Radix");
114:            //            int[] pow = testcase.getIntArray("Power");
115:            //            int[] val = testcase.getIntArray("Value");
116:            //            logln("radix: " + radix + " pow: " + printArray(pow) + " val: " + printArray(val));
117:            //            for (int i = 0; i < pow.length; ++i) {
118:            //                if (val[i] != (int)Math.pow(radix, pow[i])) {
119:            //                    errln("radix: " + radix + " to power " + pow[i] + " != " + val[i]);
120:            //                    break;
121:            //                }
122:            //            }
123:            //        }
124:            //    }
125:
126:            // utility print functions to display the data from the resource
127:            String printArray(String[] a) {
128:                StringBuffer buf = new StringBuffer("String[] {");
129:                for (int i = 0; i < a.length; ++i) {
130:                    if (i != 0) {
131:                        buf.append(",");
132:                    }
133:                    buf.append(" " + a[i]);
134:                }
135:                buf.append(" }");
136:                return buf.toString();
137:            }
138:
139:            String printArray(int[] a) {
140:                StringBuffer buf = new StringBuffer("int[] {");
141:                for (int i = 0; i < a.length; ++i) {
142:                    if (i != 0) {
143:                        buf.append(",");
144:                    }
145:                    buf.append(" " + a[i]);
146:                }
147:                buf.append(" }");
148:                return buf.toString();
149:            }
150:
151:            String printArray(boolean[] a) {
152:                StringBuffer buf = new StringBuffer("boolean[] {");
153:                for (int i = 0; i < a.length; ++i) {
154:                    if (i != 0) {
155:                        buf.append(",");
156:                    }
157:                    buf.append(" " + a[i]);
158:                }
159:                buf.append(" }");
160:                return buf.toString();
161:            }
162:
163:            /* (non-Javadoc)
164:             * @see com.ibm.icu.dev.test.ModuleTest#processModules()
165:             */
166:            protected void processModules() {
167:                // TODO Auto-generated method stub
168:
169:            }
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.