summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikayla Ray <mikayla@livioconnect.com>2015-05-18 13:46:06 -0400
committerMikayla Ray <mikayla@livioconnect.com>2015-05-18 13:46:06 -0400
commitbebc8aeb026b4bf0ea7433fb647c28010a878f87 (patch)
treefe2edca696b31a375381a3d39bf7cc44aac6ad60
parent7815b9474794a4a50c70ad470a6252150bcfb34a (diff)
downloadsdl_android-bebc8aeb026b4bf0ea7433fb647c28010a878f87.tar.gz
Updated and documented all existing transport config test classes in the transport package.
-rw-r--r--sdl_android_tests/src/com/smartdevicelink/test/transport/BTTransportConfigTests.java40
-rw-r--r--sdl_android_tests/src/com/smartdevicelink/test/transport/BaseTransportConfigTests.java43
-rw-r--r--sdl_android_tests/src/com/smartdevicelink/test/transport/TCPTransportConfigTests.java49
3 files changed, 104 insertions, 28 deletions
diff --git a/sdl_android_tests/src/com/smartdevicelink/test/transport/BTTransportConfigTests.java b/sdl_android_tests/src/com/smartdevicelink/test/transport/BTTransportConfigTests.java
index 05d44d260..524f2769f 100644
--- a/sdl_android_tests/src/com/smartdevicelink/test/transport/BTTransportConfigTests.java
+++ b/sdl_android_tests/src/com/smartdevicelink/test/transport/BTTransportConfigTests.java
@@ -2,24 +2,42 @@ package com.smartdevicelink.test.transport;
import junit.framework.TestCase;
+import com.smartdevicelink.test.Test;
import com.smartdevicelink.transport.BTTransportConfig;
import com.smartdevicelink.transport.TransportType;
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.transport.BtTransportConfig}
+ */
public class BtTransportConfigTests extends TestCase {
- public void testValues () {
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.transport.BtTransportConfig#getTransportType()}
+ * {@link com.smartdevicelink.transport.BtTransportConfig#setKeepSocketActive(boolean)}
+ * {@link com.smartdevicelink.transport.BtTransportConfig#getKeepSocketActive}
+ */
+ public void testConfigs () {
- BTTransportConfig test1 = new BTTransportConfig();
- BTTransportConfig test2 = new BTTransportConfig(false);
- assertEquals("Values should match.", TransportType.BLUETOOTH, test1.getTransportType());
- assertEquals("Values should match.", TransportType.BLUETOOTH, test2.getTransportType());
+ // Test Values
+ boolean testBoolean = true;
+ BTTransportConfig testConfig1 = new BTTransportConfig();
+ BTTransportConfig testConfig2 = new BTTransportConfig(testBoolean);
- assertTrue("Values should match.", test1.shareConnection());
- assertFalse("Values should match.", test2.shareConnection());
+ // Comparison Values
+ TransportType expectedTransportType = TransportType.BLUETOOTH;
+ boolean actualShareConnection = testConfig2.shareConnection();
+ TransportType actualTransportType = testConfig1.getTransportType();
- test1.setKeepSocketActive(true);
- assertTrue("Value should be true.", test1.getKeepSocketActive());
- test1.setKeepSocketActive(false);
- assertFalse("Value should be false.", test1.getKeepSocketActive());
+ // Valid Tests
+ assertEquals(Test.MATCH, expectedTransportType, actualTransportType);
+ assertTrue(Test.TRUE, actualShareConnection);
+
+
+ testConfig1.setKeepSocketActive(true);
+ assertTrue(Test.TRUE, testConfig1.getKeepSocketActive());
+ testConfig1.setKeepSocketActive(false);
+ assertFalse(Test.FALSE, testConfig2.getKeepSocketActive());
}
} \ No newline at end of file
diff --git a/sdl_android_tests/src/com/smartdevicelink/test/transport/BaseTransportConfigTests.java b/sdl_android_tests/src/com/smartdevicelink/test/transport/BaseTransportConfigTests.java
index 266b66f6b..ecd220aee 100644
--- a/sdl_android_tests/src/com/smartdevicelink/test/transport/BaseTransportConfigTests.java
+++ b/sdl_android_tests/src/com/smartdevicelink/test/transport/BaseTransportConfigTests.java
@@ -2,24 +2,49 @@ package com.smartdevicelink.test.transport;
import junit.framework.TestCase;
+import com.smartdevicelink.test.Test;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.TransportType;
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.transport.BaseTransportConfig}
+ */
public class BaseTransportConfigTests extends TestCase {
- public void testValues () {
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.transport.BaseTransportConfig#getTransportType()}
+ * {@link com.smartdevicelink.transport.BaseTransportConfig#shareConnection()}
+ * {@link com.smartdevicelink.transport.BaseTransportConfig#getHeartBeatTimeout()}
+ * {@link com.smartdevicelink.transport.BaseTransportConfig#setHeartBeatTimeout(int)}
+ */
+ public void testConfigs () {
- MockBTC mock = new MockBTC();
- assertNotNull("Mock value should not be null", mock);
- assertTrue("Value should be true", mock.shareConnection());
- assertEquals("Values do not match", Integer.MAX_VALUE, mock.getHeartBeatTimeout());
+ // Test Values
+ int testInt = 10;
+ MockBaseTransportConfig testBaseTransportConfig = new MockBaseTransportConfig();
- mock.setHeartBeatTimeout(10);
- assertEquals("Values do not match", 10, mock.getHeartBeatTimeout());
+ // Comparison Values
+ int expectedMaxValue = Integer.MAX_VALUE;
+ boolean actualShareConnection = testBaseTransportConfig.shareConnection();
+ int actualMaxValue = testBaseTransportConfig.getHeartBeatTimeout();
+
+ // Valid Tests
+ assertNotNull(Test.NOT_NULL, testBaseTransportConfig);
+ assertEquals(Test.MATCH, expectedMaxValue, actualMaxValue);
+ assertTrue(Test.TRUE, actualShareConnection);
+
+ testBaseTransportConfig.setHeartBeatTimeout(testInt);
+ assertEquals(Test.MATCH, testInt, testBaseTransportConfig.getHeartBeatTimeout());
}
}
-class MockBTC extends BaseTransportConfig {
- public MockBTC () { }
+/**
+ * This is a mock class for testing the following :
+ * {@link com.smartdevicelink.transport.BaseTransportConfig}
+ */
+class MockBaseTransportConfig extends BaseTransportConfig {
+ public MockBaseTransportConfig () { }
@Override public TransportType getTransportType() { return null; }
} \ No newline at end of file
diff --git a/sdl_android_tests/src/com/smartdevicelink/test/transport/TCPTransportConfigTests.java b/sdl_android_tests/src/com/smartdevicelink/test/transport/TCPTransportConfigTests.java
index cbc38e558..0df87e05b 100644
--- a/sdl_android_tests/src/com/smartdevicelink/test/transport/TCPTransportConfigTests.java
+++ b/sdl_android_tests/src/com/smartdevicelink/test/transport/TCPTransportConfigTests.java
@@ -1,21 +1,54 @@
package com.smartdevicelink.test.transport;
+import com.smartdevicelink.test.Test;
import com.smartdevicelink.transport.TCPTransportConfig;
import com.smartdevicelink.transport.TransportType;
import junit.framework.TestCase;
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.transport.TcpTransportConfig}
+ */
public class TcpTransportConfigTests extends TestCase {
- public void testValues () {
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.transport.TcpTransportConfig#getPort()}
+ * {@link com.smartdevicelink.transport.TcpTransportConfig#getIPAddress()}
+ * {@link com.smartdevicelink.transport.TcpTransportConfig#getAutoReconnect()}
+ * {@link com.smartdevicelink.transport.TcpTransportConfig#getTransportType()}
+ */
+ public void testConfigs () {
- TCPTransportConfig test = new TCPTransportConfig(123, "test", true);
- assertEquals("Values should match.", 123, test.getPort());
- assertEquals("Values should match.", "test", test.getIPAddress());
- assertTrue("Value should be true.", test.getAutoReconnect());
- assertEquals("Values should match.", TransportType.TCP, test.getTransportType());
+ // Test Values
+ int testInt = 123;
+ String testString = "test";
+ boolean testBoolean = true;
+ TCPTransportConfig testConfig1 = new TCPTransportConfig(testInt, testString, testBoolean);
+ TCPTransportConfig testConfig2 = new TCPTransportConfig(testInt, null, testBoolean);
- String expected = "TCPTransportConfig{Port=123, IpAddress='test', AutoReconnect=true}";
- assertEquals("Values should match.", expected, test.toString());
+ // Comparison Values
+ TransportType expectedTransportType = TransportType.TCP;
+ String expectedToString1 = "TCPTransportConfig{Port=123, IpAddress='test', AutoReconnect=true}";
+ String expectedToString2 = "TCPTransportConfig{Port=123, IpAddress='null', AutoReconnect=true}";
+ int actualPort = testConfig1.getPort();
+ String actualIpAddress = testConfig1.getIPAddress();
+ String actualToString1 = testConfig1.toString();
+ String actualToString2 = testConfig2.toString();
+ String actualNullString = testConfig2.getIPAddress();
+ boolean actualAutoReconnect = testConfig1.getAutoReconnect();
+ TransportType actualTransportType = testConfig1.getTransportType();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, testInt, actualPort);
+ assertEquals(Test.MATCH, testString, actualIpAddress);
+ assertEquals(Test.MATCH, testBoolean, actualAutoReconnect);
+ assertEquals(Test.MATCH, expectedTransportType, actualTransportType);
+ assertEquals(Test.MATCH, expectedToString1, actualToString1);
+ assertEquals(Test.MATCH, expectedToString2, actualToString2);
+
+ // Invalid/Null Tests
+ assertNull(Test.NULL, actualNullString);
}
} \ No newline at end of file