diff options
author | mrfoxygmfr <mrfoxygmfr@sch9.ru> | 2025-03-23 14:53:14 +0300 |
---|---|---|
committer | mrfoxygmfr <mrfoxygmfr@sch9.ru> | 2025-03-23 14:53:14 +0300 |
commit | 249c81ef4cf1db3cf4248c33fe614ff299e2dd57 (patch) | |
tree | 2bfcea9b6e0b2f07426327d55b945ecd962d4c55 /src/test/java | |
parent | e06ab0f9e796e914529bdd55dbeb6f04846aed02 (diff) |
test(db): add simple hibernate config test
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfigTest.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfigTest.java b/src/test/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfigTest.java new file mode 100644 index 0000000..0fba515 --- /dev/null +++ b/src/test/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfigTest.java @@ -0,0 +1,26 @@ +package ru.mrfoxygmfr.warehouse_accounting.db.config; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.orm.hibernate5.LocalSessionFactoryBean; +import org.springframework.test.context.TestPropertySource; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@SpringBootTest +@TestPropertySource(locations="classpath:application.properties") +class HibernateConfigTest { + @Autowired + private LocalSessionFactoryBean sessionFactory; + + @Test + public void test() { + SessionFactory sessionFactoryObject = sessionFactory.getObject(); + assertNotNull(sessionFactoryObject); + Session session = sessionFactoryObject.openSession(); + assertNotNull(session); + } +}
\ No newline at end of file |