ylbtech-Java-Class-@I:org.junit.Test
1.返回顶部
 
2.返回顶部
 
3.返回顶部
 
4.返回顶部
1、
package org.junit;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; /**
* The <code>Test</code> annotation tells JUnit that the <code>public void</code> method
* to which it is attached can be run as a test case. To run the method,
* JUnit first constructs a fresh instance of the class then invokes the
* annotated method. Any exceptions thrown by the test will be reported
* by JUnit as a failure. If no exceptions are thrown, the test is assumed
* to have succeeded.
* <p>
* A simple test looks like this:
* <pre>
* public class Example {
* <b>@Test</b>
* public void method() {
* org.junit.Assert.assertTrue( new ArrayList().isEmpty() );
* }
* }
* </pre>
* <p>
* The <code>Test</code> annotation supports two optional parameters.
* The first, <code>expected</code>, declares that a test method should throw
* an exception. If it doesn't throw an exception or if it throws a different exception
* than the one declared, the test fails. For example, the following test succeeds:
* <pre>
* @Test(<b>expected=IndexOutOfBoundsException.class</b>) public void outOfBounds() {
* new ArrayList&lt;Object&gt;().get(1);
* }
* </pre>
* If the exception's message or one of its properties should be verified, the
* {@link org.junit.rules.ExpectedException ExpectedException} rule can be used. Further
* information about exception testing can be found at the
* <a href="https://github.com/junit-team/junit/wiki/Exception-testing">JUnit Wiki</a>.
* <p>
* The second optional parameter, <code>timeout</code>, causes a test to fail if it takes
* longer than a specified amount of clock time (measured in milliseconds). The following test fails:
* <pre>
* @Test(<b>timeout=100</b>) public void infinity() {
* while(true);
* }
* </pre>
* <b>Warning</b>: while <code>timeout</code> is useful to catch and terminate
* infinite loops, it should <em>not</em> be considered deterministic. The
* following test may or may not fail depending on how the operating system
* schedules threads:
* <pre>
* @Test(<b>timeout=100</b>) public void sleep100() {
* Thread.sleep(100);
* }
* </pre>
* <b>THREAD SAFETY WARNING:</b> Test methods with a timeout parameter are run in a thread other than the
* thread which runs the fixture's @Before and @After methods. This may yield different behavior for
* code that is not thread safe when compared to the same test method without a timeout parameter.
* <b>Consider using the {@link org.junit.rules.Timeout} rule instead</b>, which ensures a test method is run on the
* same thread as the fixture's @Before and @After methods.
*
* @since 4.0
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface Test { /**
* Default empty exception
*/
static class None extends Throwable {
private static final long serialVersionUID = 1L; private None() {
}
} /**
* Optionally specify <code>expected</code>, a Throwable, to cause a test method to succeed if
* and only if an exception of the specified class is thrown by the method. If the Throwable's
* message or one of its properties should be verified, the
* {@link org.junit.rules.ExpectedException ExpectedException} rule can be used instead.
*/
Class<? extends Throwable> expected() default None.class; /**
* Optionally specify <code>timeout</code> in milliseconds to cause a test method to fail if it
* takes longer than that number of milliseconds.
* <p>
* <b>THREAD SAFETY WARNING:</b> Test methods with a timeout parameter are run in a thread other than the
* thread which runs the fixture's @Before and @After methods. This may yield different behavior for
* code that is not thread safe when compared to the same test method without a timeout parameter.
* <b>Consider using the {@link org.junit.rules.Timeout} rule instead</b>, which ensures a test method is run on the
* same thread as the fixture's @Before and @After methods.
* </p>
*/
long timeout() default 0L;
}
2、
5.返回顶部
 
 
6.返回顶部
 
作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

最新文章

  1. centos7安装mysql5.7
  2. Best Practices for Performance_3.Improving Layout Performance 优化布局
  3. js网页中调用本地应用程序
  4. EXP的flashback_scn和flashback_time
  5. VScript 函数调用的两种分类:Sub过程和Function过程
  6. iOS开发学习记录【整理】
  7. discuz@功能的代码
  8. 滴滴司机:要不是Uber,我买奥迪的45万元不知何时赚回来呢!
  9. shell脚本获取进程ID并杀死的实现及问题解析
  10. python中的pip
  11. 【原创】大叔问题定位分享(4)Kafka集群broker节点从zookeeper上消失
  12. 《C和指针》---指针
  13. freemarker变量自加
  14. 【待考察】Appium使用技巧,助你快速入门移动端自动化!
  15. mysql 删除以某字符串开头的表
  16. Arpa’s obvious problem and Mehrdad’s terrible solution 思维
  17. wepy - 与原生有什么不同(slot插槽)
  18. linux history记录格式修改
  19. 转: android之虚拟机访问tomcat服务器资源
  20. 20155224 2016-2017-2 《Java程序设计》第9周学习总结

热门文章

  1. 每天一个Linux命令:ls(1)
  2. 同源策略 - JSONP - CORS
  3. Linux命令篇-服务器查看日志(续)
  4. git+可视化工具+github/码云
  5. 10、jqueryEasyUI感觉自己还是改行做前端吧
  6. asp.net core容器&amp;mysql容器network互联 &amp; docker compose方式编排启动多个容器
  7. HTML5自定义属性的设置与获取
  8. JavaFX开发环境安装配置
  9. what have we learnt in day five
  10. Neo4j Cypher查询语言详解