SpringBoot and JUnit

之前修改程式就要重啟整個專案服務,目前重啟需要等待3分半鐘,有了 JUnit 節省不少時間。

import java.io.IOException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;

@ActiveProfiles("DEV")
@RunWith(SpringRunner.class)
@SpringBootTest
public class SomeServiceTest throws IOException {
    @Test
    public void doTest() throws IOException {
        //....
    }
}

Leave a Comment

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *