??????????????δ???????????????????????????Щ??????????????????????????????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?????????????ɡ?

???????ε?????