SpringBoot 2.x Junit 起手式

每次開新專案都要找

所以來記錄一下
JUnit File 起手式
package com.dom.fycc;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
class YellowCalendarCacheApplicationTests {

    @Test
    void contextLoads() {
        assertEquals(0, 0);
    }

}

build.gradle

    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    
    testImplementation 'junit:junit'

切記要 test packageage 和 main package 一致

留言

  1. Use this diet hack to drop 2 lb of fat in just 8 hours

    Well over 160 000 women and men are trying a easy and SECRET "liquid hack" to burn 2lbs each and every night as they sleep.

    It is proven and works on everybody.

    You can do it yourself by following these easy steps:

    1) Go grab a drinking glass and fill it up half full

    2) And now use this weight losing hack

    you'll become 2lbs lighter as soon as tomorrow!

    回覆刪除

張貼留言

這個網誌中的熱門文章

angular 如何Http 如何設定 CORS (Cross-Origin Resource Sharing)

Google Map 單車路徑計算坡度和角度小工具

Google URL Shortener API 快速教學