首页 > 其他 > 详细

JUnit4 入门笔记

时间:2019-02-24 21:52:20      阅读:177      评论:0      收藏:0      [点我收藏+]

Test注解的两个可选参数 expected timeout

The Test annotation supports two optional parameters.
  The first, expected, 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.

@Test(expected = Exception.class)
    public void Test() {
}

The second optional parameter, timeout, causes a test to fail if it takes longer than a specified amount of clock time (measured in milliseconds).

@Test(timeout = 1000)
    public void Test() {
}

JUnit4 入门笔记

原文:https://www.cnblogs.com/vincenshen/p/10427839.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!