??ò??????????????
???????????? ???????[ 2013/6/17 10:36:25 ] ????????
??????????????δ???????????????????????????Щ??????????????????????????????order?????????????ν??“service”??????Command??????“service”??????????
@Test
public void orderIsCanceledAfterCancelling() throws Exception {
final Order order = new OrderFixture().build();
final CancelOrderCommand command = new CancelOrderCommand();
command.handle(order);
assertTrue(order.isCanceled());
}
@Test
public void orderIsAcknowledgedAfterAcknowledging() throws Exception {
final Order order = new OrderFixture().build();
final AcknowledgeOrderCommand command = new AcknowledgeOrderCommand();
command.handle(order);
assertTrue(order.isAcknowledged());
}
?????????????????????????????д????????????????????????????????Order??Command?????????????????????? ?????????????????????@Transactional???????????????????????????????“service”???
???????????????????????
public void run() {
loggingSupport.info("start running?? productId=" + productId);
if (a) {
......
} else if (b) {
......
} else {
......
}
loggingSupport.info("end running?? productId=" + productId);
}
???????????????????У?????????????????????????????
final String startText = "start running?? productId" + productId;
final String endText = "end running?? productId" + productId;
context.checking(new Expectations() {
{
oneOf(loggingSupport).info(startText);
// other expectations
oneOf(loggingSupport).info(endText);
}
});
target.run();
???????????????????????????????а???????run()?????У????????????????????????????????????????????????б?д??????????????????????????????????????????????п??????????????????????????????????????????????????????????RunnerNotifer??????????????????
public void run() {
runnerNotifier.notifyStart(productId);
if (a) {
......
} else if (b) {
......
} else {
......
}
runnerNotifier.notifyEnd(productId);
}
???????????????????????????????????????
context.checking(new Expectations() {
{
oneOf(runnerNotifier).notifyStart(productId);
// other expectations
oneOf(runnerNotifier).notifyEnd(productId);
}
});
target.run();
?????????????RunnerNotifier?????????????ɡ?
???????ε?????
??????
???·???
??????????????????
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