You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jv...@apache.org on 2011/09/19 12:23:09 UTC
svn commit: r1172557 -
/mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java
Author: jvermillard
Date: Mon Sep 19 10:23:09 2011
New Revision: 1172557
URL: http://svn.apache.org/viewvc?rev=1172557&view=rev
Log:
unit test fix
Modified:
mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java
Modified: mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java?rev=1172557&r1=1172556&r2=1172557&view=diff
==============================================================================
--- mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java (original)
+++ mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java Mon Sep 19 10:23:09 2011
@@ -1,5 +1,7 @@
package org.apache.mina.session;
+import static org.mockito.Mockito.mock;
+
import java.net.SocketAddress;
import junit.framework.Assert;
@@ -75,14 +77,15 @@ public class AbstractIoSessionTest {
@Test
public void testGetId() {
- Assert.assertNotSame((new DummySession(null)).getId(), (new DummySession(null)).getId());
+ Assert.assertNotSame((new DummySession(mock(IoService.class))).getId(),
+ (new DummySession(mock(IoService.class))).getId());
}
@Test
public void testCreationTime() {
long before = System.currentTimeMillis();
- long creation = (new DummySession(null)).getCreationTime();
+ long creation = (new DummySession(mock(IoService.class))).getCreationTime();
long after = System.currentTimeMillis();
Assert.assertTrue(creation <= after);
Assert.assertTrue(creation >= before);
@@ -90,7 +93,7 @@ public class AbstractIoSessionTest {
@Test
public void testAttachment() {
- AbstractIoSession aio = new DummySession(null);
+ AbstractIoSession aio = new DummySession(mock(IoService.class));
String value = "value";
Assert.assertNull(aio.getAttribute("test"));
Assert.assertEquals(null, aio.setAttribute("test", value));
@@ -105,7 +108,7 @@ public class AbstractIoSessionTest {
Assert.assertFalse(aio.containsAttribute("test"));
Assert.assertEquals(null, aio.getAttribute("test"));
- Assert.assertNull(aio.getService());
+ Assert.assertNotNull(aio.getService());
}
}