JUnit @DataJpaTest 模板

2020-07-14  本文已影响0人  Lyudmilalala
package cn.com.spinq.quantumCloudComputingService.task;

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

import java.util.LinkedList;
import java.util.List;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.dao.DataIntegrityViolationException;

import cn.com.spinq.quantumCloudComputingService.task.repository.GateRepository;

@SpringBootTest(classes = {QuantumCloudComputingTaskApplication.class})
@TestMethodOrder(OrderAnnotation.class)
class GateRepositoryTest {

    @Autowired
    private GateRepository gateRepository;
    
    @Test
    @Order(1)  
    public void createTest() {
        System.out.println("============ Enter PlatformRepository createTest ===========");
        
        //create one test
        
        //create a list test
        
        System.out.println("============ Exit PlatformRepository createTest ===========");
    }

    @Test
    @Order(2)
    public void createFailTest() {
        System.out.println("============ Enter PlatformRepository createFailTest ===========");
        
        //create invalid test
        
        System.out.println("============ Exit PlatformRepository createFailTest ===========");
    }

    @Test
    @Order(3) 
    public void selectTest() {
        System.out.println("============ Enter PlatformRepository selectTest ===========");
        
        //find all test
        
        //find one by id test
        
        //find a list by id test
        
        //find one by name test
        
        //find a list by name test
        
        //find one not exist test
        
        //find a list not exist test
        
        System.out.println("============ Exit PlatformRepository selectTest ===========");
    }

    @Test
    @Order(4) 
    public void updateTest() {
        System.out.println("============ Enter PlatformRepository updateTest ===========");
        System.out.println("============ Exit PlatformRepository updateTest ===========");
    }
    
    @Test
    @Order(5) 
    public void deleteTest() {
        System.out.println("============ Enter PlatformRepository deleteTest ===========");
        //delete exist test
        
        //delete not exist test
        
        //delete all test
        
        System.out.println("============ Exit PlatformRepository deleteTest ===========");
    }

}
上一篇下一篇

猜你喜欢

热点阅读