How to fill database in tests for Spring projects if smth different from CrudRepository is used? #2347
              
                Unanswered
              
          
                  
                    
                      EgorkaKulikov
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Consider generating integration tests for the method in Spring project that interacts with the database. In such case we should save some data in the database and verify that it is processed correctly.
For example, if we test a method
The following code is generated as a part of test method
This code is generated under the assumption that repositories in user project implement
CrudRepositorythat hassavemethod. This assumption is highly likely correct.However, there is a marker interface
Repositoryin Spring that does not have any specified method to save. What should we do?Also, user may have some non-Spring libraries for database processing, like
mybatisand it seems to be very difficult to deal with. Just one of the reasons is that some not compatible withH2(used in concrete execution) dialect of SQL may be used.Beta Was this translation helpful? Give feedback.
All reactions