Xiao Peng

My personal blog moves to xiaopeng.me , blogs about design patterns will be synced to here.
肖鹏,ThoughtWorks资深咨询师,目前关注于架构模式、敏捷软件开发等领域,并致力于软件开发最佳实践的推广和应用。
多次为国内大型企业敏捷组织转型提供咨询和培训服务,在大型团队持续集成方面具有丰富的经验。
  博客园  :: 首页  :: 联系 :: 订阅 订阅  :: 管理

Maillis精选-[TDD]State machine

Posted on 2006-11-07 23:00  勇敢的鸵鸟  阅读(0)  评论(0)    收藏  举报

We can write the first test for your
State Machine object. Select a method on it, then choose inputs and the
output you expect, then write the test. I might try this:
TransitionTable transitionTable =
TransitionTable.withStartState("a")
.withTransition("a", 1, "b")
.withEndState("b");
StateMachine stateMachine = new StateMachine(transitionTable);
assertEquals("b", stateMachine.transition("a", 1));
assertTrue(statemAchine.isInEndState());

This is a simple test for a simple state machine.