/*******************************************************************************
 * 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));
	}
}

/*******************************************************************************
 * 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 {

	// Different SPNEGO messages. For details and specification,
	// see http://msdn.microsoft.com/en-us/library/ms995330.aspx
	
	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[] 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));
		assertFalse(SPNegoMessage.isSPNegoMessage(badMessage));
	}

	@Test
	public void testIsNegTokenInit() {
		assertTrue(SPNegoMessage.isNegTokenInit(negTokenInitOk));
		assertFalse(SPNegoMessage.isNegTokenInit(negTokenInitTooShort));
		assertFalse(SPNegoMessage.isNegTokenInit(badMessage));
	}
}

Add separate test for NegTokenInit.