softwareTesting_work2_question2
- work2类
package com.Phantom; import java.util.Scanner; import javax.print.DocFlavor.INPUT_STREAM; public class work2 {
String str=null;
StringBuffer re_str=null; public String getStr() {
return str;
} public void setStr(String str) {
this.str = str;
} public StringBuffer getRe_str() {
return re_str;
} public work2() {
super();
} public String input(){
System.out.println("请输入内容:");
//str = "how are you";
String strs[] = str.split(" ");
re_str = new StringBuffer();
for(int i = strs.length-1; i >= 0; i--){
//测试
//System.out.println(strs[i]);
re_str.append(" "+strs[i]);
}
System.out.println("输出:"+re_str);
return re_str.toString();
} } - testing类
package com.Phantom; import static org.junit.Assert.*;
import junit.framework.TestCase; import org.junit.After;
import org.junit.Before;
import org.junit.Test; public class testing extends TestCase { private work2 w;
@Before
public void setUp() throws Exception {
super.setUp();
w=new work2();
} @After
public void tearDown() throws Exception {
System.out.println("w.getStr()>>>"+w.getStr());
System.out.println("w.getRe_str()>>>"+w.getRe_str());
} @Test
public void test() {
// fail("Not yet implemented");
w.setStr("as sa");
w.input();
assertTrue(w.getRe_str().toString()=="sa as");} }
junit
覆盖率
softwareTesting_work2_question2的更多相关文章
随机推荐
- blade and soul zone overview
The world of Blade and Soul, is a vast extension of land containing two continents (the Southern Con ...
- 伪静态重写模块rewrite.dll及httpd.ini文件参考下载
伪静态重写模块rewrite.dll及httpd.ini文件参考下载 http://www.ledaokj.com/download/rewrite.rar 服务器端开启伪静态,可以查看以下文章< ...
- thunkify和co的邂逅
上一篇说到thunkify的作用,这一篇说一下thunkify和co的集合 co中有一块代码 /** * Convert a thunk to a promise. * * @param {Funct ...
- Coding源码学习第四部分(Masonry介绍与使用(三))
接上篇继续进行Masonry 的学习. (12)tableViewCell 布局 #import "TableViewController.h" #import "Tes ...
- JSFuck奇葩的js编码
以前对黑客很崇拜,黑客的世界无比精彩.最近为了炫耀,想起了这段特殊的代码. [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[ ...
- 最近用到js筛选一个url的域名部分(草创)
var TLD = ['com','net','org','gov','edu','mil','biz','name','info','mobi','cn','hk']; var host = ''; ...
- React之Composition Vs inheritance 组合Vs继承
React的组合 composition: props有个特殊属性,children,组件可以通过props.children拿到所有包含在内的子元素, 当组件内有子元素时,组件属性上的child ...
- visual studio code 安装python扩展
Ctrl+P 调出控制台,在控制台里输入ext install python,点击第一个安装 如果出现: visual studio code connect ETIMEDOUT 191.238.17 ...
- druid.properties的配置
driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://NoOne:3306/eyes<!--需修改--> username=root ...
- mysql 修改root密码
1.找到配置文件my.ini ,然后将其打开,可以选择用记事本打开 C:\Program Files (x86)\MySQL\MySQL Server 5.0 2.打开后,搜索mysqld关键字,找 ...