<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 117  文章 - 72  trackbacks - 0

    聲明:原創作品(標有[原]字樣)轉載時請注明出處,謝謝。

    常用鏈接

    常用設置
    常用軟件
    常用命令
     

    訂閱

    訂閱

    留言簿(7)

    隨筆分類(130)

    隨筆檔案(123)

    搜索

    •  

    積分與排名

    • 積分 - 155602
    • 排名 - 391

    最新評論

    [標題]:[轉]JUnit4.5 QuickTutorial
    [時間]:2009-7-5
    [摘要]:JUnit官方例子QuickTutorial
    [關鍵字]:JUnit、Test、測試、單元測試、helloworld
    [環境]:JUnit4.5、MyEclipse7
    [作者]:Winty (wintys@gmail.com) http://www.tkk7.com/wintys

    [正文]:
    Subscription.java:
    package wintys.junit;

    /**
     * JUnit4.5 QuickTutorial
     * http://code.google.com/p/t2framework/wiki/JUnitQuickTutorial
     *  
     * @author Winty
     * @version 2009-07-04
     */
    public class Subscription {
           private int price ; // subscription total price in euro-cent
           private int length ; // length of subscription in months

           // constructor :
           public Subscription(int p, int n) {
             price = p ;
             length = n ;
           }

          /**
           * Calculate the monthly subscription price in euro,
           * rounded up to the nearest cent.
           */
           public double pricePerMonth() {
             double r = (double) price / (double) length /100.0;
              return r ;
           }

          /**
           * Call this to cancel/nulify this subscription.
           */
           public void cancel() { length = 0 ; }
    }

    用JUnit測試:
    SubscriptionTest.java:
    package wintys.junit;

    import static org.junit.Assert.*;

    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;

    public class SubscriptionTest {
        Subscription S;

        @Before
        public void setUp() throws Exception {
             S = new Subscription(200,2) ;
        }

        @After
        public void tearDown() throws Exception {
            S = null;
        }

        @Test
        public void testPricePerMonth() {
            
            assertEquals(S.pricePerMonth() , 1.0);
        }

    }

    [參考資料]:
    JUnitQuickTutorial : http://code.google.com/p/t2framework/wiki/JUnitQuickTutorial
    posted on 2009-07-07 23:49 天堂露珠 閱讀(335) 評論(0)  編輯  收藏 所屬分類: Test

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 国产老女人精品免费视频| 无码免费午夜福利片在线| 亚洲区小说区图片区| 国产亚洲午夜精品| 成人永久免费高清| 羞羞视频免费网站入口| 波多野结衣视频在线免费观看| 亚洲AV无码一区二区三区牲色| 日韩成人在线免费视频| 羞羞网站免费观看| 国产精品亚洲产品一区二区三区 | 麻豆精品不卡国产免费看| 亚洲男人av香蕉爽爽爽爽| 国产免费福利体检区久久| 亚洲国产日韩在线视频| 香蕉成人免费看片视频app下载| 91天堂素人精品系列全集亚洲 | 色屁屁在线观看视频免费| 亚洲国产婷婷综合在线精品| 2022免费国产精品福利在线| 久久综合日韩亚洲精品色| 18禁美女裸体免费网站| 亚洲欧美成人一区二区三区| 亚洲av片一区二区三区| 水蜜桃视频在线观看免费播放高清| 亚洲精品无码不卡| 女人18毛片免费观看| 一级成人生活片免费看| 337p日本欧洲亚洲大胆精品555588| 免费AA片少妇人AA片直播| 羞羞视频在线免费观看| 久久久影院亚洲精品| 91在线视频免费91| 又黄又大的激情视频在线观看免费视频社区在线 | 久久免费99精品国产自在现线 | 高清在线亚洲精品国产二区| 99久久婷婷免费国产综合精品| 亚洲国产一区在线观看| 亚洲国产a级视频| 18女人水真多免费高清毛片| 国产亚洲女在线线精品|