mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-26 21:35:46 +00:00
HHH-13974 Test efficiency improvements
This commit is contained in:
parent
68edfadc65
commit
60a063bce2
@ -7,6 +7,8 @@
|
|||||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
@ -22,6 +24,8 @@
|
|||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class SessionBuilderFlushModeTest {
|
public class SessionBuilderFlushModeTest {
|
||||||
|
|
||||||
|
private static SessionFactory sessionFactory;
|
||||||
|
|
||||||
@Parameters
|
@Parameters
|
||||||
public static FlushMode[] parameters() {
|
public static FlushMode[] parameters() {
|
||||||
return FlushMode.values();
|
return FlushMode.values();
|
||||||
@ -30,12 +34,23 @@ public static FlushMode[] parameters() {
|
|||||||
@Parameter
|
@Parameter
|
||||||
public FlushMode flushMode;
|
public FlushMode flushMode;
|
||||||
|
|
||||||
@Test
|
@BeforeClass
|
||||||
public void testFlushMode() {
|
public static void setup() {
|
||||||
try (final SessionFactory sessionFactory = new MetadataSources( new StandardServiceRegistryBuilder().build() ).buildMetadata().buildSessionFactory()) {
|
sessionFactory = new MetadataSources( new StandardServiceRegistryBuilder().build() ).buildMetadata().buildSessionFactory();
|
||||||
try (final Session session = sessionFactory.withOptions().flushMode( flushMode ).openSession()) {
|
}
|
||||||
assertEquals( flushMode, session.getHibernateFlushMode() );
|
|
||||||
}
|
@AfterClass
|
||||||
|
public static void tearDown() {
|
||||||
|
if ( sessionFactory != null ) {
|
||||||
|
sessionFactory.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFlushMode() {
|
||||||
|
try (final Session session = sessionFactory.withOptions().flushMode( flushMode ).openSession()) {
|
||||||
|
assertEquals( flushMode, session.getHibernateFlushMode() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user