knightoftheroundtabletest.java

来自「Spring in Action 的代码」· Java 代码 · 共 27 行

JAVA
27
字号
package com.springinaction.chapter01.knight;import com.springinaction.chapter01.knight.HolyGrail;
import com.springinaction.chapter01.knight.HolyGrailQuest;
import com.springinaction.chapter01.knight.KnightOfTheRoundTable;
import com.springinaction.chapter01.knight.QuestException;

import junit.framework.TestCase;


public class KnightOfTheRoundTableTest extends TestCase {
  public void testEmbarkOnQuest() {
    KnightOfTheRoundTable knight = new KnightOfTheRoundTable("Bedivere");
    
    knight.setQuest(new HolyGrailQuest());
    
    try {
      HolyGrail grail = (HolyGrail) knight.embarkOnQuest();
      
      assertNotNull(grail);
      
      assertTrue(grail.isHoly());
    } catch (QuestException e) {
      fail();
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?