大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全家桶1年46,售后保障稳定
Junit测试文件的编写
先贴个简单的例子大家感受一下
package se.test;
import static org.junit.Assert.*;
import java.io.FileNotFoundException;
import org.junit.Test;
import se.lab.Graph;
import se.lab.Main;
public class MainTest01 {
@Test
public void testQueryBridgeWords() throws FileNotFoundException {
Graph graph = new Main().createDirectedGraph("F:\\test.txt") ;
String t1 ="No \"\" in the graph!";
assertEquals(t1,new Main().queryBridgeWords(graph,"","you"));
}
}
最重要的一句就是
assertEquals(t1,new Main().queryBridgeWords(graph,"","you"));
判断两个字符串是否相等。
是不是很简单呢?
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/234420.html原文链接:https://javaforall.net