From 249c81ef4cf1db3cf4248c33fe614ff299e2dd57 Mon Sep 17 00:00:00 2001 From: mrfoxygmfr Date: Sun, 23 Mar 2025 14:53:14 +0300 Subject: test(db): add simple hibernate config test --- .../db/config/HibernateConfigTest.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfigTest.java (limited to 'src/test/java/ru/mrfoxygmfr') 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 -- cgit mrf-deployment