package com.smartdevicelink.test.transport;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.smartdevicelink.test.Test;
import com.smartdevicelink.transport.enums.TransportType;

import junit.framework.TestCase;

/**
 * This is a unit test class for the SmartDeviceLink library project class : 
 * {@link com.smartdevicelink.transport.enums.TransportType}
 */
public class TransportTypeTests extends TestCase {
	
	/**
	 * This is a unit test for the following enum : 
	 * {@link com.smartdevicelink.transport.enums.TransportType}
	 */
	public void testTransportTypeEnum () {
		
		// Test Values
		String testTcp       	= "TCP";
		String testUsb       	= "USB";
		String testInvalid   	= "INVALID";
		String testBluetooth 	= "BLUETOOTH";
		String testMultiplexing = "MULTIPLEX";
		String testWebSocketServer = "WEB_SOCKET_SERVER";
		
		try {
			// Comparison Values
			TransportType expectedTcpEnum        	= TransportType.TCP;
			TransportType expectedUsbEnum        	= TransportType.USB;
			TransportType expectedBluetoothEnum  	= TransportType.BLUETOOTH;
			TransportType expectedMultiplexingEnum  = TransportType.MULTIPLEX;
			TransportType expectedWebSocketServerEnum  = TransportType.WEB_SOCKET_SERVER;
			
			List<TransportType> expectedEnumList = new ArrayList<TransportType>();
			expectedEnumList.add(TransportType.BLUETOOTH);
			expectedEnumList.add(TransportType.TCP);
			expectedEnumList.add(TransportType.USB);
			expectedEnumList.add(TransportType.MULTIPLEX);
			expectedEnumList.add(TransportType.WEB_SOCKET_SERVER);
			
			TransportType actualNullEnum       		= TransportType.valueForString(null);
			TransportType actualTcpEnum        		= TransportType.valueForString(testTcp);
			TransportType actualUsbEnum        		= TransportType.valueForString(testUsb);
			TransportType actualInvalidEnum    		= TransportType.valueForString(testInvalid);
			TransportType actualBluetoothEnum  		= TransportType.valueForString(testBluetooth);
			TransportType actualMultiplexingEnum 	= TransportType.valueForString(testMultiplexing);
			TransportType actualWebSocketServerEnum 	= TransportType.valueForString(testWebSocketServer);

			List<TransportType> actualEnumList = Arrays.asList(TransportType.values());
			
			// Valid Tests
			assertEquals(Test.MATCH, expectedTcpEnum, actualTcpEnum);
			assertEquals(Test.MATCH, expectedUsbEnum, actualUsbEnum);
			assertEquals(Test.MATCH, expectedBluetoothEnum, actualBluetoothEnum);
			assertEquals(Test.MATCH, expectedMultiplexingEnum, actualMultiplexingEnum);
			assertEquals(Test.MATCH, expectedWebSocketServerEnum, actualWebSocketServerEnum);
			assertTrue(Test.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
			
			// Invalid/Null Tests
			assertNull(Test.NULL, actualInvalidEnum);
			assertNull(Test.NULL, actualNullEnum);
		
		} catch (NullPointerException e) {
			fail("Could not retrieve value for null string, should return null.");
		} catch (IllegalArgumentException e) {
			fail("Could not retrieve value for invalid string, should return null.");
		}
	}
}
@@ -652,16 +652,17 @@
        %09
+%09
 = %22TCP%22;
@@ -686,16 +686,17 @@
        %09
+%09
 = %22USB%22;
@@ -720,16 +720,17 @@
 alid   %09
+%09
 = %22INVAL
@@ -758,16 +758,17 @@
 etooth %09
+%09
 = %22BLUET
@@ -800,16 +800,17 @@
 plexing 
+%09
 = %22MULTI
@@ -845,16 +845,17 @@
 tServer 
+%09
 = %22WEB_S
@@ -871,16 +871,51 @@
 VER%22;%0A%09%09
+String testGeneric %09%09%09= %22GENERIC%22;%0A
 %0A%09%09try %7B
@@ -972,32 +972,33 @@
 TcpEnum        %09
+%09
 = TransportType.
@@ -1043,16 +1043,17 @@
        %09
+%09
 = Transp
@@ -1106,16 +1106,17 @@
 hEnum  %09
+%09
 = Transp
@@ -1173,24 +1173,25 @@
 lexingEnum  
+%09
 = TransportT
@@ -1251,16 +1251,17 @@
 erEnum  
+%09
 = Transp
@@ -1286,24 +1286,87 @@
 _SERVER;%0A%09%09%09
+TransportType expectedGenericEnum  %09%09%09= TransportType.GENERIC;%0A
 %0A%09%09%09List%3CTra
@@ -1673,24 +1673,69 @@
 SERVER);%0A%09%09%09
+expectedEnumList.add(TransportType.GENERIC);%0A
 %0A%09%09%09Transpor
@@ -1755,32 +1755,33 @@
 ullEnum       %09%09
+%09
 = TransportType.
@@ -1834,32 +1834,33 @@
 cpEnum        %09%09
+%09
 = TransportType.
@@ -1916,32 +1916,33 @@
 sbEnum        %09%09
+%09
 = TransportType.
@@ -2002,24 +2002,25 @@
 idEnum    %09%09
+%09
 = TransportT
@@ -2084,32 +2084,33 @@
 luetoothEnum  %09%09
+%09
 = TransportType.
@@ -2177,24 +2177,25 @@
 lexingEnum %09
+%09
 = TransportT
@@ -2328,16 +2328,100 @@
 Server);
+%0A%09%09%09TransportType actualGenericEnum%09%09%09 %09= TransportType.valueForString(testGeneric);
 %0A%0A%09%09%09Lis
@@ -2870,24 +2870,93 @@
 erverEnum);%0A
+%09%09%09assertEquals(Test.MATCH, expectedGenericEnum, actualGenericEnum);%0A
 %09%09%09assertTru

Fix transport type tests