Source Code Cross Referenced for JavaTest.java in  » Scripting » jacl » tests » 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 » Scripting » jacl » tests 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * JavaTest.java --
003:         *
004:         *	This file contains the JavaTest class used by java.test.
005:         *
006:         * Copyright (c) 1997 by Sun Microsystems, Inc.
007:         *
008:         * See the file "license.terms" for information on usage and redistribution
009:         * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
010:         *
011:         * RCS: @(#) $Id: JavaTest.java,v 1.5 2006/06/19 02:54:27 mdejong Exp $
012:         */
013:
014:        package tests;
015:
016:        import tcl.lang.*;
017:        import java.util.*;
018:
019:        public class JavaTest implements  CommandWithDispose {
020:
021:            // Constructors.
022:
023:            public JavaTest() {
024:            }
025:
026:            public JavaTest(String s) {
027:            }
028:
029:            public JavaTest(String s, int i) {
030:            }
031:
032:            public JavaTest(boolean b) {
033:                throw new NullPointerException();
034:            }
035:
036:            // Constants.
037:
038:            public static final int JT1 = 3;
039:            public final int JT2 = 4;
040:            private static final int JT3 = 5;
041:            private final int JT4 = 6;
042:
043:            // Static fields for each primitive type.
044:
045:            public static boolean sboolean;
046:            public static byte sbyte;
047:            public static short sshort;
048:            public static int sint;
049:            public static long slong;
050:            public static float sfloat;
051:            public static double sdouble;
052:            public static char schar;
053:            public static String sstr;
054:
055:            public static JavaTest sobj;
056:
057:            // Static methods.
058:
059:            public static String smethod() {
060:                return "static";
061:            }
062:
063:            public static String nullsmethod() {
064:                return null;
065:            }
066:
067:            public static void voidsmethod() {
068:                return;
069:            }
070:
071:            // Instance fields for each type.
072:
073:            public int iint = 123;
074:            public boolean iboolean = false;
075:            public long ilong = 123;
076:            public short ishort = 123;
077:            public byte ibyte = 123;
078:            public float ifloat = (float) 123.0;
079:            public double idouble = 123.0;
080:            public char ichar = 'J';
081:            public String istr = "test string";
082:
083:            public Integer iobj1 = new Integer(123);
084:            public String iobj2 = new String("test string obj");
085:            public Object iobj3 = new Vector();
086:            public Object iobjnull = null;
087:
088:            public JavaTest iobj;
089:
090:            // Instance methods.
091:
092:            public int imethod() {
093:                return 6;
094:            }
095:
096:            public int imethod(int i) {
097:                return i + 1;
098:            }
099:
100:            public String nullimethod() {
101:                return null;
102:            }
103:
104:            public void voidimethod() {
105:                return;
106:            }
107:
108:            public void failMethod() {
109:                throw new NullPointerException();
110:            }
111:
112:            // Simple Tcl command implementation.
113:
114:            public void cmdProc(Interp interp, TclObject argv[])
115:                    throws TclException {
116:                String s = argv[0].toString();
117:                for (int i = 1; i < argv.length; i++) {
118:                    s = s + ", " + argv[i].toString();
119:                }
120:
121:                if (iboolean) {
122:                    interp.setResult(s + ": success");
123:                } else {
124:                    throw new TclException(interp, s + ": failure", TCL.ERROR);
125:                }
126:            }
127:
128:            public void disposeCmd() {
129:                istr = "disposed";
130:            }
131:
132:            // Returns the java.lang.String that was passed in
133:            // used to test argument conversion.
134:
135:            public static String retStr(String str) {
136:                return str;
137:            }
138:
139:            // Throw Tcl error from Java method.
140:
141:            public static void throwTclException(Interp interp)
142:                    throws TclException {
143:                throw new TclException(interp, "no nuts in my fudge please!");
144:            }
145:
146:            // Raise NullPointerException if Interp.setResult()
147:            // is invoked with a null pointer.
148:
149:            public static String testSetResultNPE(Interp interp)
150:                    throws TclException {
151:                try {
152:                    interp.setResult((TclObject) null);
153:                } catch (NullPointerException npe) {
154:                    return "OK";
155:                }
156:                return "ERROR";
157:            }
158:
159:            public static String testResetResultNPE(Interp interp)
160:                    throws TclException {
161:                try {
162:                    interp.resetResult();
163:                    interp.setResult((TclObject) null);
164:                } catch (NullPointerException npe) {
165:                    return "OK";
166:                }
167:                return "ERROR";
168:            }
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.