blob: b7b79fcaf23417fc7964176a1b2e7cd0b64524a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
package com.smartdevicelink.test.rpc.enums;
import com.smartdevicelink.proxy.rpc.enums.ECallConfirmationStatus;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.ECallConfirmationStatus}
*/
public class ECallConfirmationStatusTests extends TestCase {
/**
* Verifies that the enum values are not null upon valid assignment.
*/
public void testValidEnums () {
String example = "NORMAL";
ECallConfirmationStatus enumNormal = ECallConfirmationStatus.valueForString(example);
example = "CALL_IN_PROGRESS";
ECallConfirmationStatus enumCallInProgress = ECallConfirmationStatus.valueForString(example);
example = "CALL_CANCELLED";
ECallConfirmationStatus enumCancelled = ECallConfirmationStatus.valueForString(example);
example = "CALL_COMPLETED";
ECallConfirmationStatus enumCompleted = ECallConfirmationStatus.valueForString(example);
example = "CALL_UNSUCCESSFUL";
ECallConfirmationStatus enumUnsuccessful = ECallConfirmationStatus.valueForString(example);
example = "ECALL_CONFIGURED_OFF";
ECallConfirmationStatus enumConfiguredOff = ECallConfirmationStatus.valueForString(example);
example = "CALL_COMPLETE_DTMF_TIMEOUT";
ECallConfirmationStatus enumCompleteDtmfTimeout = ECallConfirmationStatus.valueForString(example);
assertNotNull("NORMAL returned null", enumNormal);
assertNotNull("CALL_IN_PROGRESS returned null", enumCallInProgress);
assertNotNull("CALL_CANCELLED returned null", enumCancelled);
assertNotNull("CALL_COMPLETED returned null", enumCompleted);
assertNotNull("CALL_UNSUCCESSFUL returned null", enumUnsuccessful);
assertNotNull("ECALL_CONFIGURED_OFF returned null", enumConfiguredOff);
assertNotNull("CALL_COMPLETE_DTMF_TIMEOUT returned null", enumCompleteDtmfTimeout);
}
/**
* Verifies that an invalid assignment is null.
*/
public void testInvalidEnum () {
String example = "noRMal";
try {
ECallConfirmationStatus temp = ECallConfirmationStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
}
catch (IllegalArgumentException exception) {
fail("Null string throws NullPointerException.");
}
}
/**
* Verifies that a null assignment is invalid.
*/
public void testNullEnum () {
String example = null;
try {
ECallConfirmationStatus temp = ECallConfirmationStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
}
catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
}
}
/**
* Verifies the possible enum values of ECallConfirmationStatus.
*/
public void testListEnum() {
List<ECallConfirmationStatus> enumValueList = Arrays.asList(ECallConfirmationStatus.values());
List<ECallConfirmationStatus> enumTestList = new ArrayList<ECallConfirmationStatus>();
enumTestList.add(ECallConfirmationStatus.NORMAL);
enumTestList.add(ECallConfirmationStatus.CALL_IN_PROGRESS);
enumTestList.add(ECallConfirmationStatus.CALL_CANCELLED);
enumTestList.add(ECallConfirmationStatus.CALL_COMPLETED);
enumTestList.add(ECallConfirmationStatus.CALL_UNSUCCESSFUL);
enumTestList.add(ECallConfirmationStatus.ECALL_CONFIGURED_OFF);
enumTestList.add(ECallConfirmationStatus.CALL_COMPLETE_DTMF_TIMEOUT);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}
}
|