directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r190255 - /directory/network/branches/dirmina-39/src/test/org/apache/mina/common/FutureTest.java
Date Sun, 12 Jun 2005 11:51:16 GMT
Author: trustin
Date: Sun Jun 12 04:51:16 2005
New Revision: 190255

URL: http://svn.apache.org/viewcvs?rev=190255&view=rev
Log:
More strict testing on Futures

Modified:
    directory/network/branches/dirmina-39/src/test/org/apache/mina/common/FutureTest.java

Modified: directory/network/branches/dirmina-39/src/test/org/apache/mina/common/FutureTest.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/dirmina-39/src/test/org/apache/mina/common/FutureTest.java?rev=190255&r1=190254&r2=190255&view=diff
==============================================================================
--- directory/network/branches/dirmina-39/src/test/org/apache/mina/common/FutureTest.java
(original)
+++ directory/network/branches/dirmina-39/src/test/org/apache/mina/common/FutureTest.java
Sun Jun 12 04:51:16 2005
@@ -1,5 +1,6 @@
 package org.apache.mina.common;
 
+import java.io.IOException;
 import java.net.SocketAddress;
 
 import junit.framework.TestCase;
@@ -23,6 +24,15 @@
         assertTrue( future.isReady() );
         assertTrue( future.isClosed() );
         
+        thread = new TestThread( future );
+        thread.start();
+        
+        future.setClosed( false );
+        thread.join();
+        
+        assertTrue( thread.success );
+        assertTrue( future.isReady() );
+        assertFalse( future.isClosed() );
     }
     
     public void testConnectFuture() throws Exception
@@ -90,6 +100,24 @@
         assertTrue( future.isReady() );
         assertTrue( future.isConnected() );
         assertEquals( session, future.getSession() );
+        
+        thread = new TestThread( future );
+        thread.start();
+        future.setException( new IOException() );
+        thread.join();
+        
+        assertTrue( thread.success );
+        assertTrue( future.isReady() );
+        assertFalse( future.isConnected() );
+        
+        try
+        {
+            future.getSession();
+            fail( "IOException should be thrown." );
+        }
+        catch( IOException e )
+        {
+        }
     }
     
     public void testWriteFuture() throws Exception
@@ -107,6 +135,16 @@
         assertTrue( thread.success );
         assertTrue( future.isReady() );
         assertTrue( future.isWritten() );
+
+        thread = new TestThread( future );
+        thread.start();
+        
+        future.setWritten( false );
+        thread.join();
+        
+        assertTrue( thread.success );
+        assertTrue( future.isReady() );
+        assertFalse( future.isWritten() );
     }
     
     private static class TestThread extends Thread



Mime
View raw message