Source Code Cross Referenced for Test.java in  » Testing » junit » org » junit » 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 » Testing » junit » org.junit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package org.junit;
02:
03:        import java.lang.annotation.ElementType;
04:        import java.lang.annotation.Retention;
05:        import java.lang.annotation.RetentionPolicy;
06:        import java.lang.annotation.Target;
07:
08:        /**
09:         * <p>The <code>Test</code> annotation tells JUnit that the <code>public void</code> method
10:         * to which it is attached can be run as a test case. To run the method,
11:         * JUnit first constructs a fresh instance of the class then invokes the
12:         * annotated method. Any exceptions thrown by the test will be reported
13:         * by JUnit as a failure. If no exceptions are thrown, the test is assumed
14:         * to have succeeded.</p>
15:         * 
16:         * <p>A simple test looks like this:
17:         * <pre>
18:         * public class Example {
19:         *    <b>&#064;Test</b> 
20:         *    public void method() {
21:         *       org.junit.Assert.assertTrue( new ArrayList().isEmpty() );
22:         *    }
23:         * }
24:         * </pre>
25:         * </p>
26:         * 
27:         * <p>The <code>Test</code> annotation supports two optional parameters.
28:         * The first, <code>expected</code>, declares that a test method should throw
29:         * an exception. If it doesn't throw an exception or if it throws a different exception
30:         * than the one declared, the test fails. For example, the following test succeeds:
31:         * <pre>
32:         *    &#064;Test(<b>expected=IndexOutOfBoundsException.class</b>) public void outOfBounds() {
33:         *       new ArrayList&lt;Object&gt;().get(1);
34:         *    }
35:         * </pre></p>
36:         * 
37:         * <p>The second optional parameter, <code>timeout</code>, causes a test to fail if it takes 
38:         * longer than a specified amount of clock time (measured in milliseconds). The following test fails:
39:         * <pre>
40:         *    &#064;Test(<b>timeout=100</b>) public void infinity() {
41:         *       while(true);
42:         *    }
43:         * </pre></p>
44:         */
45:        @Retention(RetentionPolicy.RUNTIME)
46:        @Target(ElementType.METHOD)
47:        public @interface Test {
48:
49:            /**
50:             * Default empty exception
51:             */
52:            static class None extends Throwable {
53:                private static final long serialVersionUID = 1L;
54:
55:                private None() {
56:                }
57:            }
58:
59:            /**
60:             * Optionally specify <code>expected</code>, a Throwable, to cause a test method to succeed iff 
61:             * an exception of the specified class is thrown by the method.
62:             */
63:            Class<? extends Throwable> expected() default None.class;
64:
65:            /** 
66:             * Optionally specify <code>timeout</code> in milliseconds to cause a test method to fail if it
67:             * takes longer than that number of milliseconds.*/
68:            long timeout() default 0L;
69:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.