美文网首页
JUnit @DataJpaTest 模板

JUnit @DataJpaTest 模板

作者: Lyudmilalala | 来源:发表于2020-07-14 14:53 被阅读0次
    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 ===========");
        }
    
    }
    

    相关文章

      网友评论

          本文标题:JUnit @DataJpaTest 模板

          本文链接:https://www.haomeiwen.com/subject/cyxfhktx.html