Example usage for org.hibernate.engine.spi SharedSessionContractImplementor isOpen

List of usage examples for org.hibernate.engine.spi SharedSessionContractImplementor isOpen

Introduction

In this page you can find the example usage for org.hibernate.engine.spi SharedSessionContractImplementor isOpen.

Prototype

boolean isOpen();

Source Link

Document

Check if the session is still open.

Usage

From source file:org.kie.server.services.jbpm.xstream.HibernateXStreamMarshallerExtensionTest.java

License:Apache License

@Test
public void testMarshallDummyHibernatePersistenceBag() {
    SharedSessionContractImplementor session = Mockito.mock(SharedSessionContractImplementor.class);
    Mockito.when(session.isOpen()).thenReturn(true);
    Mockito.when(session.isConnected()).thenReturn(true);
    PersistentBag bag = new PersistentBag(session, new ArrayList<String>());
    String expectedOutput = "<list/>";
    Marshaller marshaller = MarshallerFactory.getMarshaller(MarshallingFormat.XSTREAM,
            getClass().getClassLoader());
    Assert.assertEquals(expectedOutput, marshaller.marshall(bag));
}