java junit

请问怎么用 junut测试工具测试代码啊?

新建一个class,新建一个方法,加上Test注释,写完之后,run as junit Test
给你举个例子吧:
//实现图片的复制
@Test
public void testImgCopy() throws Exception{
File f = new File("/Users/lixiuming/Desktop/商品详情图片/detail-1.jpg");
FileInputStream fis = new FileInputStream(f);
File out = new File("/Users/lixiuming/Desktop/project/day_15/detail-1.jpg");
FileOutputStream fos = new FileOutputStream(out);
byte[] b= new byte[1024];
int len;
while((len = fis.read(b)) != -1){
fos.write(b, 0, len);
}
}