directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r1037123 - /directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/
Date Sat, 20 Nov 2010 06:33:16 GMT
Author: felixk
Date: Sat Nov 20 06:33:15 2010
New Revision: 1037123

URL: http://svn.apache.org/viewvc?rev=1037123&view=rev
Log:
Let test fail with a more specific description than just resulting in a class cast exception

Modified:
    directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
    directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java
    directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
    directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java
    directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
    directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java
    directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java
    directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java?rev=1037123&r1=1037122&r2=1037123&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java Sat Nov 20 06:33:15 2010
@@ -123,7 +123,9 @@ public class AuthenticationEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEType() );
     }
@@ -173,7 +175,9 @@ public class AuthenticationEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
         assertTrue( "PRE_AUTHENT flag", reply.getTicket().getEncTicketPart().getFlags().isPreAuth() );
@@ -226,7 +230,9 @@ public class AuthenticationEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
         assertTrue( "PRE_AUTHENT flag", reply.getTicket().getEncTicketPart().getFlags().isPreAuth() );
@@ -269,7 +275,9 @@ public class AuthenticationEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC has no support for encryption type", 14, error.getErrorCode() );
     }
 

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java?rev=1037123&r1=1037122&r2=1037123&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java Sat Nov 20 06:33:15 2010
@@ -20,6 +20,8 @@
 package org.apache.directory.server.kerberos.protocol;
 
 
+import static org.junit.Assert.assertEquals;
+
 import org.apache.directory.server.kerberos.kdc.KdcServer;
 import org.apache.directory.server.kerberos.shared.KerberosConstants;
 import org.apache.directory.server.kerberos.shared.KerberosMessageType;
@@ -29,11 +31,9 @@ import org.apache.directory.server.kerbe
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -103,7 +103,9 @@ public class AuthenticationPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -139,7 +141,9 @@ public class AuthenticationPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -175,7 +179,9 @@ public class AuthenticationPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -211,7 +217,9 @@ public class AuthenticationPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -247,7 +255,9 @@ public class AuthenticationPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -286,7 +296,9 @@ public class AuthenticationPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -324,7 +336,9 @@ public class AuthenticationPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 }

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java?rev=1037123&r1=1037122&r2=1037123&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java Sat Nov 20 06:33:15 2010
@@ -127,7 +127,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Requested protocol version number not supported", 3, error.getErrorCode() );
     }
 
@@ -143,14 +145,18 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Incorrect message direction", 47, error.getErrorCode() );
 
         message = new KdcRequest( 5, KerberosMessageType.TGS_REP, null, null );
 
         handler.messageReceived( session, message );
 
-        error = ( ErrorMessage ) session.getMessage();
+        msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        error = ( ErrorMessage ) msg;
         assertEquals( "Incorrect message direction", 47, error.getErrorCode() );
     }
 
@@ -175,7 +181,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Client not found in Kerberos database", 6, error.getErrorCode() );
     }
 
@@ -218,7 +226,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC has no support for encryption type", 14, error.getErrorCode() );
     }
 
@@ -246,7 +256,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Server not found in Kerberos database", 7, error.getErrorCode() );
     }
 
@@ -268,7 +280,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "The client or server has a null key", 9, error.getErrorCode() );
     }
 
@@ -297,7 +311,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "The client or server has a null key", 9, error.getErrorCode() );
     }
 
@@ -339,7 +355,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         KerberosTime expectedStartTime = new KerberosTime( now );
         boolean isClose = reply.getStartTime() == null
@@ -388,7 +406,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         KerberosTime expectedStartTime = new KerberosTime( now );
         boolean isClose = reply.getStartTime() == null
@@ -437,7 +457,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         KerberosTime expectedStartTime = new KerberosTime( now );
         boolean isClose = reply.getStartTime() == null
@@ -485,7 +507,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Requested start time is later than end time", 11, error.getErrorCode() );
     }
 
@@ -528,7 +552,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Requested start time is later than end time", 11, error.getErrorCode() );
     }
 
@@ -570,7 +596,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Ticket not eligible for postdating", 10, error.getErrorCode() );
     }
 
@@ -624,7 +652,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "Requested start time", requestedStartTime.equals( reply.getStartTime() ) );
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
@@ -675,7 +705,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
 
@@ -719,7 +751,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         KerberosTime expectedEndTime = new KerberosTime( now + KerberosTime.DAY );
         boolean isClose = Math.abs( reply.getEndTime().getTime() - expectedEndTime.getTime() ) < 5000;
@@ -758,7 +792,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         long now = System.currentTimeMillis();
         KerberosTime expectedEndTime = new KerberosTime( now + KerberosTime.DAY );
@@ -798,7 +834,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "INITIAL flag", reply.getFlags().isInitial() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -851,7 +889,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         KerberosTime expectedEndTime = new KerberosTime( now + KerberosTime.DAY );
         boolean isClose = Math.abs( reply.getEndTime().getTime() - expectedEndTime.getTime() ) < 5000;
@@ -901,7 +941,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "FORWARDABLE flag", reply.getFlags().isForwardable() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -946,7 +988,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "MAY_POSTDATE flag", reply.getFlags().isMayPosdate() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -991,7 +1035,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "PROXIABLE flag", reply.getFlags().isProxiable() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -1042,7 +1088,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "RENEWABLE flag", reply.getFlags().isRenewable() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -1096,7 +1144,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        AuthenticationReply reply = ( AuthenticationReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", AuthenticationReply.class, msg.getClass() );
+        AuthenticationReply reply = ( AuthenticationReply ) msg;
 
         assertTrue( "RENEWABLE flag", reply.getFlags().isRenewable() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -1142,7 +1192,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC cannot accommodate requested option", 13, error.getErrorCode() );
     }
 
@@ -1179,7 +1231,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC cannot accommodate requested option", 13, error.getErrorCode() );
     }
 
@@ -1216,7 +1270,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC cannot accommodate requested option", 13, error.getErrorCode() );
     }
 
@@ -1253,7 +1309,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC cannot accommodate requested option", 13, error.getErrorCode() );
     }
 
@@ -1290,7 +1348,9 @@ public class AuthenticationServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC cannot accommodate requested option", 13, error.getErrorCode() );
     }
 }

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java?rev=1037123&r1=1037122&r2=1037123&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java Sat Nov 20 06:33:15 2010
@@ -20,6 +20,8 @@
 package org.apache.directory.server.kerberos.protocol;
 
 
+import static org.junit.Assert.assertEquals;
+
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.kerberos.kdc.KdcServer;
@@ -38,7 +40,6 @@ import org.apache.directory.server.kerbe
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -143,7 +144,9 @@ public class EncTktInSkeyTest extends Ab
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC cannot accommodate requested option", 13, error.getErrorCode() );
     }
 }

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java?rev=1037123&r1=1037122&r2=1037123&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java Sat Nov 20 06:33:15 2010
@@ -105,7 +105,9 @@ public class PreAuthenticationTest exten
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Additional pre-authentication required", 25, error.getErrorCode() );
     }
 
@@ -146,7 +148,9 @@ public class PreAuthenticationTest exten
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Integrity check on decrypted field failed", 31, error.getErrorCode() );
     }
 
@@ -184,7 +188,9 @@ public class PreAuthenticationTest exten
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
 
         assertEquals( "Pre-authentication information was invalid", 24, error.getErrorCode() );
     }
@@ -220,7 +226,9 @@ public class PreAuthenticationTest exten
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
 
         assertEquals( "KDC has no support for padata type", 16, error.getErrorCode() );
     }

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java?rev=1037123&r1=1037122&r2=1037123&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java Sat Nov 20 06:33:15 2010
@@ -20,6 +20,8 @@
 package org.apache.directory.server.kerberos.protocol;
 
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -45,7 +47,6 @@ import org.apache.directory.server.kerbe
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -133,7 +134,9 @@ public class TicketGrantingEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEType() );
     }
@@ -185,7 +188,9 @@ public class TicketGrantingEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
@@ -250,7 +255,9 @@ public class TicketGrantingEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
@@ -315,7 +322,9 @@ public class TicketGrantingEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
@@ -381,7 +390,9 @@ public class TicketGrantingEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
@@ -448,7 +459,9 @@ public class TicketGrantingEncryptionTyp
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEType() );
         assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java?rev=1037123&r1=1037122&r2=1037123&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java Sat Nov 20 06:33:15 2010
@@ -136,7 +136,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -186,7 +188,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -241,7 +245,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -291,7 +297,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -346,7 +354,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -401,7 +411,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -451,7 +463,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -501,7 +515,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -552,7 +568,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -596,7 +614,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -646,7 +666,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 
@@ -699,7 +721,9 @@ public class TicketGrantingPolicyTest ex
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC policy rejects request", 12, error.getErrorCode() );
     }
 }

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java?rev=1037123&r1=1037122&r2=1037123&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java Sat Nov 20 06:33:15 2010
@@ -20,6 +20,11 @@
 package org.apache.directory.server.kerberos.protocol;
 
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.net.InetAddress;
 import java.util.HashSet;
 import java.util.Set;
@@ -51,10 +56,6 @@ import org.apache.directory.server.kerbe
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
 
 
 /**
@@ -164,7 +165,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Requested protocol version number not supported", 3, error.getErrorCode() );
     }
 
@@ -203,7 +206,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Server not found in Kerberos database", 7, error.getErrorCode() );
     }
 
@@ -253,7 +258,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "KDC has no support for padata type", 16, error.getErrorCode() );
     }
 
@@ -294,7 +301,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Inappropriate type of checksum in message", 50, error.getErrorCode() );
     }
 
@@ -377,7 +386,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Integrity check on decrypted field failed", 31, error.getErrorCode() );
     }
 
@@ -416,7 +427,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "The ticket isn't for us", 35, error.getErrorCode() );
     }
 
@@ -457,7 +470,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         KerberosTime expectedRenewTillTime = tgt.getEncTicketPart().getRenewTill();
         boolean isClose = Math.abs( reply.getRenewTill().getTime() - expectedRenewTillTime.getTime() ) < 5000;
@@ -508,7 +523,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         KerberosTime expectedRenewTillTime = tgt.getEncTicketPart().getRenewTill();
         boolean isClose = Math.abs( reply.getRenewTill().getTime() - expectedRenewTillTime.getTime() ) < 5000;
@@ -563,7 +580,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "PROXY flag", reply.getFlags().isProxy() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -622,7 +641,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "FORWARDED flag", reply.getFlags().isForwarded() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -676,7 +697,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Ticket expired", 32, error.getErrorCode() );
     }
 
@@ -725,7 +748,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        ErrorMessage error = ( ErrorMessage ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
+        ErrorMessage error = ( ErrorMessage ) msg;
         assertEquals( "Ticket expired", 32, error.getErrorCode() );
     }
 
@@ -774,7 +799,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         KerberosTime expectedEndTime = tgt.getEncTicketPart().getEndTime();
         boolean isClose = Math.abs( reply.getEndTime().getTime() - expectedEndTime.getTime() ) < 5000;
@@ -826,7 +853,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         KerberosTime expectedEndTime = new KerberosTime( now + KerberosTime.DAY );
         boolean isClose = Math.abs( reply.getEndTime().getTime() - expectedEndTime.getTime() ) < 5000;
@@ -866,6 +895,8 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
         ErrorMessage error = ( ErrorMessage ) session.getMessage();
         assertEquals( "KDC has no support for encryption type", 14, error.getErrorCode() );
     }
@@ -906,6 +937,8 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
         ErrorMessage error = ( ErrorMessage ) session.getMessage();
         assertEquals( "The client or server has a null key", 9, error.getErrorCode() );
     }
@@ -956,7 +989,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         KerberosTime expectedStartTime = new KerberosTime( now );
         boolean isClose = reply.getStartTime() == null
@@ -1013,7 +1048,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         KerberosTime expectedStartTime = new KerberosTime( now );
         boolean isClose = reply.getStartTime() == null
@@ -1070,7 +1107,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         KerberosTime expectedStartTime = new KerberosTime( now );
         boolean isClose = reply.getStartTime() == null
@@ -1128,6 +1167,8 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
         ErrorMessage error = ( ErrorMessage ) session.getMessage();
         assertEquals( "Requested start time is later than end time", 11, error.getErrorCode() );
     }
@@ -1182,6 +1223,8 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
         ErrorMessage error = ( ErrorMessage ) session.getMessage();
         assertEquals( "Requested start time is later than end time", 11, error.getErrorCode() );
     }
@@ -1234,6 +1277,8 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
         ErrorMessage error = ( ErrorMessage ) session.getMessage();
         assertEquals( "Ticket not eligible for postdating", 10, error.getErrorCode() );
     }
@@ -1300,7 +1345,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "Requested start time", requestedStartTime.equals( reply.getStartTime() ) );
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
@@ -1355,7 +1402,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "PRE_AUTHENT flag", reply.getTicket().getEncTicketPart().getFlags().isPreAuth() );
     }
@@ -1405,7 +1454,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "Requested end time", requestedEndTime.equals( reply.getEndTime() ) );
     }
@@ -1456,7 +1507,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         KerberosTime expectedEndTime = new KerberosTime( now + KerberosTime.DAY );
         boolean isClose = Math.abs( reply.getEndTime().getTime() - expectedEndTime.getTime() ) < 5000;
@@ -1504,7 +1557,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         long now = System.currentTimeMillis();
         KerberosTime expectedEndTime = new KerberosTime( now + KerberosTime.DAY );
@@ -1562,7 +1617,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         KerberosTime expectedEndTime = new KerberosTime( now + KerberosTime.DAY );
         boolean isClose = Math.abs( reply.getEndTime().getTime() - expectedEndTime.getTime() ) < 5000;
@@ -1622,7 +1679,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "FORWARDABLE flag", reply.getFlags().isForwardable() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -1677,7 +1736,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "MAY_POSTDATE flag", reply.getFlags().isMayPosdate() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -1732,7 +1793,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "PROXIABLE flag", reply.getFlags().isProxiable() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -1793,7 +1856,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "RENEWABLE flag", reply.getFlags().isRenewable() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -1857,7 +1922,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertTrue( "RENEWABLE flag", reply.getFlags().isRenewable() );
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
@@ -1914,7 +1981,9 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
-        TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", TicketGrantReply.class, msg.getClass() );
+        TicketGrantReply reply = ( TicketGrantReply ) msg;
 
         assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
         assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().isInvalid() );
@@ -1957,6 +2026,8 @@ public class TicketGrantingServiceTest e
 
         handler.messageReceived( session, message );
 
+        Object msg = session.getMessage();
+        assertEquals( "session.getMessage() instanceOf", ErrorMessage.class, msg.getClass() );
         ErrorMessage error = ( ErrorMessage ) session.getMessage();
         assertEquals( "KDC cannot accommodate requested option", 13, error.getErrorCode() );
     }



Mime
View raw message