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

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

Introduction

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

Prototype

boolean isConnected();

Source Link

Document

Check if the session is currently connected.

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));
}