Spring/Hibernate/Junit example of testing DAO against HSQLDB

后端 未结 5 1495

I\'m working on trying to implement a JUnit test to check the functionality of a DAO. (The DAO will create/read a basic object/table relationship).

The trouble

5条回答
  •  情话喂你
    2021-02-02 14:21

    My application context looks a bit different

    
        
        
        
        
    
    
        
        
    
    

    and my test class looks like this:

    public class Tester {
    
        private EmbeddedDatabase db;
    
        @Before
         public void setUp(){
            db = new EmbeddedDatabaseBuilder().addDefaultScripts().build();
    
    
        }
    
        @Test
        public void TestMe(){
            System.out.println("Testing");
        }
    
    
        @After
        public void tearDown(){
    
            db.shutdown();
        }
    }
    

提交回复
热议问题