Permalink
Browse files

Add unit test for NegTokenArg.

  • Loading branch information...
1 parent 9153e9b commit b96e5f96162b9075790ecb9473bd39220113869f @AriSuutariST AriSuutariST committed Jan 29, 2014
Showing with 19 additions and 0 deletions.
  1. +19 −0 Source/JNA/waffle-jna/src-test/waffle/util/SPNegoMessageTests.java
@@ -29,13 +29,25 @@
private static final byte[] negTokenInitOk = { 0x60, 0x76, 0x06, 0x06, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x02 };
private static final byte[] negTokenInitTooShort = { 0x60, 0x76, 0x06, 0x06, 0x2B, 0x06, 0x01, 0x05, 0x05 };
+
+ private static final byte[] negTokenArgOk = { (byte)0xA1, 0x33, 0x30, 0x31, 0x0, 0x03, 0x0A, 0x01,
+ 0x01, 0x0, 0x2A, 0x04, 0x28, 0x4E, 0x54, 0x4C, 0x4D,
+ 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0,
+ 0x0, 0x08, 0x0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x06, 0x01, 0x0, 0x1D, 0x00, 0x00, 0x00, 0x0F };
+
+ private static final byte[] negTokenArgTooShort = { (byte)0xA1, 0x33, 0x30, 0x31, 0x0, 0x03 };
+
private static final byte[] badMessage = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
@Test
public void testIsSPNegoMessage() {
assertFalse(SPNegoMessage.isSPNegoMessage(null));
assertTrue(SPNegoMessage.isSPNegoMessage(negTokenInitOk));
assertFalse(SPNegoMessage.isSPNegoMessage(negTokenInitTooShort));
+ assertTrue(SPNegoMessage.isSPNegoMessage(negTokenArgOk));
+ assertFalse(SPNegoMessage.isSPNegoMessage(negTokenArgTooShort));
assertFalse(SPNegoMessage.isSPNegoMessage(badMessage));
}
@@ -45,4 +57,11 @@ public void testIsNegTokenInit() {
assertFalse(SPNegoMessage.isNegTokenInit(negTokenInitTooShort));
assertFalse(SPNegoMessage.isNegTokenInit(badMessage));
}
+
+ @Test
+ public void testIsNegTokenArg() {
+ assertTrue(SPNegoMessage.isNegTokenArg(negTokenArgOk));
+ assertFalse(SPNegoMessage.isNegTokenArg(negTokenArgTooShort));
+ assertFalse(SPNegoMessage.isNegTokenArg(badMessage));
+ }
}

0 comments on commit b96e5f9

Please sign in to comment.