/*******************************************************************************
 * Waffle (https://github.com/dblock/waffle)
 * 
 * Copyright (c) 2010 Application Security, Inc.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Application Security, Inc.
 *******************************************************************************/
package waffle.util;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;


/**
 * @author ari.suutari[at]syncrontech[dot]com
 */
public class SPNegoMessageTests {

	@Test
	public void testIsSPNegoMessage() {
		assertFalse(SPNegoMessage.isSPNegoMessage(null));
		byte[] msg = { 0x60, 0x76, 0x06, 0x06, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x02  };
		assertTrue(SPNegoMessage.isSPNegoMessage(msg));
		byte[] shortMessage = { 0x60, 0x76, 0x06, 0x06, 0x2B, 0x06, 0x01, 0x05, 0x05 };
		assertFalse(SPNegoMessage.isSPNegoMessage(shortMessage));
		byte[] badMessage = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
				0x00 };
		assertFalse(SPNegoMessage.isSPNegoMessage(badMessage));
	}
}

@@ -787,254 +787,293 @@
 %7B%0A%0A%09
-@Test%0A%09public void testIsSPNegoMessage() %7B%0A%09%09assertFalse(SPNegoMessage.isSPNegoMessage(null));%0A%09%09byte%5B%5D msg = %7B 0x60, 0x76, 0x06, 0x06, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x02  %7D;%0A%09%09assertTrue(SPNegoMessage.isSPNegoMessage(msg));%0A%09%09byte%5B%5D shortMessage
+// Different SPNEGO messages. For details and specification,%0A%09// see http://msdn.microsoft.com/en-us/library/ms995330.aspx%0A%09%0A%09private static final byte%5B%5D negTokenInitOk = %7B 0x60, 0x76, 0x06, 0x06, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x02  %7D;%0A%09private static final byte%5B%5D negTokenInitTooShort
  = %7B
@@ -1134,69 +1134,29 @@
 %7D;%0A%09
-%09assertFalse(SPNegoMessage.isSPNegoMessage(shortMessage));%0A%09%09
+private static final 
 byte
@@ -1224,64 +1224,518 @@
 x00,
-%0A%09%09%09%090x00 %7D;%0A%09%09assertFalse(SPNegoMessage.isSPNegoMessage
+ 0x00 %7D;%0A%09%0A%09@Test%0A%09public void testIsSPNegoMessage() %7B%0A%09%09assertFalse(SPNegoMessage.isSPNegoMessage(null));%0A%09%09assertTrue(SPNegoMessage.isSPNegoMessage(negTokenInitOk));%0A%09%09assertFalse(SPNegoMessage.isSPNegoMessage(negTokenInitTooShort));%0A%09%09assertFalse(SPNegoMessage.isSPNegoMessage(badMessage));%0A%09%7D%0A%0A%09@Test%0A%09public void testIsNegTokenInit() %7B%0A%09%09assertTrue(SPNegoMessage.isNegTokenInit(negTokenInitOk));%0A%09%09assertFalse(SPNegoMessage.isNegTokenInit(negTokenInitTooShort));%0A%09%09assertFalse(SPNegoMessage.isNegTokenInit
 (bad

Add separate test for NegTokenInit.