HHH-8683 Adapting unit test to changed deserialize() method in 4.3
This commit is contained in:
parent
b95b8514d8
commit
953260e0ae
|
@ -24,6 +24,8 @@
|
||||||
package org.hibernate.engine.spi;
|
package org.hibernate.engine.spi;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -32,7 +34,6 @@ import java.io.ObjectInputStream;
|
||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.engine.internal.StatefulPersistenceContext;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +118,7 @@ public class EntityEntryTest {
|
||||||
oos.flush();
|
oos.flush();
|
||||||
|
|
||||||
InputStream is = new ByteArrayInputStream( baos.toByteArray() );
|
InputStream is = new ByteArrayInputStream( baos.toByteArray() );
|
||||||
EntityEntry deserializedEntry = EntityEntry.deserialize(new ObjectInputStream( is ), new StatefulPersistenceContext( null ) );
|
EntityEntry deserializedEntry = EntityEntry.deserialize(new ObjectInputStream( is ), getPersistenceContextMock() );
|
||||||
|
|
||||||
assertEquals( LockMode.OPTIMISTIC, deserializedEntry.getLockMode() );
|
assertEquals( LockMode.OPTIMISTIC, deserializedEntry.getLockMode() );
|
||||||
assertEquals( Status.MANAGED, deserializedEntry.getStatus() );
|
assertEquals( Status.MANAGED, deserializedEntry.getStatus() );
|
||||||
|
@ -127,6 +128,7 @@ public class EntityEntryTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private EntityEntry createEntityEntry() {
|
private EntityEntry createEntityEntry() {
|
||||||
|
|
||||||
return new EntityEntry(
|
return new EntityEntry(
|
||||||
Status.MANAGED, // status
|
Status.MANAGED, // status
|
||||||
new Object[]{}, // loadedState
|
new Object[]{}, // loadedState
|
||||||
|
@ -138,7 +140,15 @@ public class EntityEntryTest {
|
||||||
null, // persister
|
null, // persister
|
||||||
true, // disableVersionIncrement
|
true, // disableVersionIncrement
|
||||||
true, // lazyPropertiesAreUnfetched
|
true, // lazyPropertiesAreUnfetched
|
||||||
new StatefulPersistenceContext( null ) // persistenceContext)
|
getPersistenceContextMock() // persistenceContext)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final PersistenceContext getPersistenceContextMock() {
|
||||||
|
SessionImplementor sessionMock = mock( SessionImplementor.class );
|
||||||
|
PersistenceContext persistenceContextMock = mock( PersistenceContext.class );
|
||||||
|
when( persistenceContextMock.getSession() ).thenReturn( sessionMock );
|
||||||
|
|
||||||
|
return persistenceContextMock;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue