package com.Phantom;

 import java.rmi.server.Operation;
import java.util.Scanner; public class Work3_2 { /**
* @param args
*/
float x;
float y;
String step1;
String step2;
String step3; public void setX(float x) {
this.x = x;
} public void setY(float y) {
this.y = y;
} public Work3_2() {
} public int operation(){
step1="a";
if(x<4||y>0){
step2="b";
if(y>1){
step3="c";
y=y+1;
}
else{
step3="d";
}
}
else{
step2="e";
if(x>=5){
step3="f";
x=x-y;
}
else{
step3="g";
x=x+y;
}
}
System.out.println("输出X >>>"+x);
System.out.println("输出Y >>>"+y);
System.out.println("路径:");
System.out.println(step1+"——>"+step2+"——>"+step3);
return 0;
} }

测试类

 package com.Phantom;

 import static org.junit.Assert.*;

 import org.junit.After;
import org.junit.Before;
import org.junit.Test; public class Work3_2_teting {
private Work3_2 w1;
@Before
public void setUp() throws Exception {
w1=new Work3_2();
} @After
public void tearDown() throws Exception {
} @Test
public void test() {
/*
* a-e-g
* */
w1.setX(4);
w1.setY(0);
w1.operation();
System.out.println("-----------------");
/*
* a-e-f
* */
w1.setX(5);
w1.setY(0);
w1.operation();
System.out.println("-----------------");
/*
* a-b-d_(1)
* */
w1.setX(4);
w1.setY((float) 0.1);
w1.operation();
System.out.println("-----------------");
/*
* a-b-d_(2)
* */
w1.setX(3);
w1.setY(-1);
w1.operation();
System.out.println("-----------------");
/*
* a-b-c
* */
w1.setX(4);
w1.setY(2);
w1.operation();
System.out.println("-----------------"); } }

运行junit测试

software_testing_work3_question2的更多相关文章

随机推荐

  1. 《精通C#》十四章-.NET程序集入门

    在书中,这一章节的开头说的是自定义命名空间和使用命名空间,在以我目前有限的经验来说,程序集就是一个类库经过编译之后,所生成的一个在引用命名空间,进而使用该文件中已经定义好的字段,属性以及方法的文件,以 ...

  2. 生产排产表DL-ZPPR002

    *&---------------------------------------------------------------------* *& Report ZPPR002 * ...

  3. 前端常用的几个js判断(一)

    1. 禁止右键点击$(document).ready(function(){ $(document).bind("contextmenu",function(e){ return ...

  4. 转载C#下RSA算法的实现(适用于支付宝和易宝支付)

    RSA算法代码: using System; using System.Collections.Generic; using System.Text; using System.IO; using S ...

  5. [原创]在Docker上部署mongodb分片副本集群。

    一.安装docker. 请参考:http://www.cnblogs.com/hehexiaoxia/p/6150584.html 二.编写dockerfile. 1.在根目录下创建mongod的do ...

  6. Sql Server xml 类型字段的增删改查

    1.定义表结构 在MSSM中新建数据库表CommunicateItem,定义其中一个字段ItemContentXml 为xml类型 2.编辑表数据,新增一行,发现xml类型不能通过设计器录入数据. 需 ...

  7. redhat openshift 跳转

    网址: https://openshift.redhat.com/ OpenShift免费套餐的限制是:最多15PV/s,有3个512MB内存的应用,月流量在50K以下. 可以绑米,可惜的是,需要代理 ...

  8. 使用Javascript中变量的setter属性

    在讲JDK的动态代理方法之前,不妨先想想如果让你来实现一个可以任意类的任意方法的代理类,该怎么实现?有个很naive的做法,通过反射获得Class和Method,再调用该方法,并且实现一些代理的方法. ...

  9. Python Day02

    Python 代码执行流程: 编译 --> 执行 源代码  -->  字节码  -->  机器码  --> CPU执行 python 先将自己的源代码,编译成Python 字节 ...

  10. 微信APP支付服务端开发Java版(一)

    一.准备工作 去微信开发者中心下载(扫码支付,里面的大部分代码是可以用的) https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=11 ...