??ζ??????????е??????
???????????? ???????[ 2012/12/10 10:23:14 ] ????????
???????????Scrumgathering??????????о?????????????????????scrum????????????????????????????????????????????????????????????ζ??????????????????????????????????Щ????????????????????????????????????????????
??????ν?????????legacy code?????????????κβ???????????????????????Щ?????????в???????????????????Щ????????????????testability??
?????????
public class Car{
private Engine engine;
public Car(){
engine = new Engine(10);
}
public boolean isMove(){
return engine.speed()>0? true:false;
}
}
??????????class??test case????????????
public class TestCase{
private Car car;
public void testMove(){
car = new Car();
Assert.assertEquals(true??car.isMove());
}
}
??????????????????У????????????????????Car??isMove???????????????Car???????Engine????????????????????????????????????????isMove?????е??????????????????Car????????????н???????
??????Car??????????????????
public class Car{
private Engine engine;
public Car(Engine engine??{
this.engine = engine;
}
public boolean isMove(){
return engine.speed()>0?true:false;
}
}
??????????????£?
public class TestCase{
public Car car;
public void testIsMove(){
Engine engine = new MockEngine(10);
car = new Car(engine);
Assert.assertEquals(true??car.isMove());
}
}
??????????????????????????????????????isMove???????????????????Engine????????????mock???engine??????????????Engine????????????????п?????
??????????
????????????????????????????????????????private????????в?????????????????????????????????????????????÷???????????????е?????????????????????????·?????????????????????private???????protected????????????????????б??????????ж?protected?????????????????????????????????t??????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11