Junit的annotation(注释、注解)
来源:互联网 发布:mac设置桌面图标 编辑:程序博客网 时间:2024/05/29 23:45
package com.jimmy.test;
import static org.junit.Assert.*;import static org.hamcrest.Matchers.*;
import org.junit.AfterClass;import org.junit.Before;import org.junit.After;import org.junit.BeforeClass;import org.junit.Test;
import com.jimmy.T;
public class TTest { @BeforeClass public static void beforeclass(){ System.out.println("beforeclass"); } @Before public void before(){ System.out.println("before"); } @Test public void testAdd() { int z=new T().add(5,5); assertThat(z, is(10)); } @Test(expected=java.lang.ArithmeticException.class) public void testDivide(){ int z=new T().divide(8, 0); assertThat(z,is(2)); } @After public void after(){ System.out.println("after"); } @AfterClass public static void afterclass(){ System.out.println("afterclass"); }}
用@Test 表名方法是测试方法,expected表示该方法抛出异常,timeout表示该方法要在几秒内完成才算成功
@Ignore 忽略该方法,不进行测试
@before 每个测试方法执行前执行
@after 每个测试方法执行后执行
@BeforeClass 所有测试运行之前(测试类运行之前) 执行
@AfterClass 所有测试运行之前(测试类运行之前) 执行
- Junit的annotation(注释、注解)
- JUnit中的注解(Annotation)
- @interface java注解--Java的Annotation注释
- JUnit4中的 Annotation(注解、注释)
- 03Junit Junit的annotation
- java的Annotation(注释)
- JUnit的annotation
- JDK 5 Annotation\注解\注释\自定义注解
- JDK 5 Annotation\注解\注释\自定义注解
- JDK 5 Annotation\注解\注释\自定义注解
- Java的Annotation(注解)
- Annotation(注解)_注解的自定义
- spring-基于注释(Annotation)的配置
- spring-基于注释(Annotation)的配置
- 注释(annotation)的开发
- Java注释(Annotation)
- Java注释(Annotation)
- hibernate annotation(注释)
- Hibernate学习笔记(九)【高级篇】并发、Session管理
- sql优化
- [LeetCode]Binary Tree Zigzag Level Order Traversal
- Makefile 的编写过程(实践)
- 如何使用SOCKET 发送HTTP1.1 GET POST请求包
- Junit的annotation(注释、注解)
- Android Sensor传感器系统架构初探
- aodv-uu-0.9.6编译移植Mini6410 组建ad-hoc网络 .
- WIN7的EPROCESS和PEB和WINXPSP3的EPROCESS
- 与林昊一起探讨OSGi
- java设计模式—工厂模式
- 蛋疼的规律题
- 防止 c 头文件以嵌套包含及变量重复定义
- 求集合的幂集