use of com.canoo.impl.server.util.HttpSessionMock in project dolphin-platform by canoo.
the class ClientSessionImplTest method testImmutableAttributeSet.
@Test(expectedExceptions = UnsupportedOperationException.class)
public void testImmutableAttributeSet() {
// given:
ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
// then:
dolphinSession.getAttributeNames().add("att");
}
use of com.canoo.impl.server.util.HttpSessionMock in project dolphin-platform by canoo.
the class ClientSessionImplTest method testMultipleAttributes.
@Test
public void testMultipleAttributes() {
// given:
ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
// when:
dolphinSession.setAttribute("test-attribute1", "Hello Dolphin Session");
dolphinSession.setAttribute("test-attribute2", "Yeah!");
dolphinSession.setAttribute("test-attribute3", "Dolphin Platform");
// then:
Assert.assertEquals(3, dolphinSession.getAttributeNames().size());
Assert.assertTrue(dolphinSession.getAttributeNames().contains("test-attribute1"));
Assert.assertTrue(dolphinSession.getAttributeNames().contains("test-attribute2"));
Assert.assertTrue(dolphinSession.getAttributeNames().contains("test-attribute3"));
Assert.assertEquals("Hello Dolphin Session", dolphinSession.getAttribute("test-attribute1"));
Assert.assertEquals("Yeah!", dolphinSession.getAttribute("test-attribute2"));
Assert.assertEquals("Dolphin Platform", dolphinSession.getAttribute("test-attribute3"));
}
use of com.canoo.impl.server.util.HttpSessionMock in project dolphin-platform by canoo.
the class ClientSessionImplTest method testAddAttribute.
@Test
public void testAddAttribute() {
// given:
ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
// when:
dolphinSession.setAttribute("test-attribute", "Hello Dolphin Session");
// then:
Assert.assertEquals(1, dolphinSession.getAttributeNames().size());
Assert.assertTrue(dolphinSession.getAttributeNames().contains("test-attribute"));
Assert.assertEquals("Hello Dolphin Session", dolphinSession.getAttribute("test-attribute"));
}
use of com.canoo.impl.server.util.HttpSessionMock in project dolphin-platform by canoo.
the class ClientSessionImplTest method testImmutableAttributeSet2.
@Test(expectedExceptions = UnsupportedOperationException.class)
public void testImmutableAttributeSet2() {
// given:
ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
// when:
dolphinSession.setAttribute("test-attribute", "Hello Dolphin Session");
// then:
dolphinSession.getAttributeNames().remove("test-attribute");
}
use of com.canoo.impl.server.util.HttpSessionMock in project dolphin-platform by canoo.
the class ClientSessionImplTest method testRemoveAttribute.
@Test
public void testRemoveAttribute() {
// given:
ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
// when:
dolphinSession.setAttribute("test-attribute", "Hello Dolphin Session");
dolphinSession.removeAttribute("test-attribute");
// then:
Assert.assertEquals(0, dolphinSession.getAttributeNames().size());
Assert.assertNull(dolphinSession.getAttribute("test-attribute"));
}
Aggregations