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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
package com.smartdevicelink.test.rpc.enums;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
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.ImageFieldName}
*/
public class ImageFieldNameTests extends TestCase {
/**
* Verifies that the enum values are not null upon valid assignment.
*/
public void testValidEnums () {
String example = "softButtonImage";
ImageFieldName enumSoftButtonImage = ImageFieldName.valueForString(example);
example = "choiceImage";
ImageFieldName enumChoiceImage = ImageFieldName.valueForString(example);
example = "choiceSecondaryImage";
ImageFieldName enumSecondaryImage = ImageFieldName.valueForString(example);
example = "vrHelpItem";
ImageFieldName enumVrHelpItem = ImageFieldName.valueForString(example);
example = "turnIcon";
ImageFieldName enumTurnIcon = ImageFieldName.valueForString(example);
example = "menuIcon";
ImageFieldName enumMenuIcon = ImageFieldName.valueForString(example);
example = "cmdIcon";
ImageFieldName enumCmdIcon = ImageFieldName.valueForString(example);
example = "appIcon";
ImageFieldName enumAppIcon = ImageFieldName.valueForString(example);
example = "graphic";
ImageFieldName enumGraphicIcon = ImageFieldName.valueForString(example);
example = "showConstantTBTIcon";
ImageFieldName enumShowConstantTbtIcon = ImageFieldName.valueForString(example);
example = "showConstantTBTNextTurnIcon";
ImageFieldName enumShowConstantTbtNextTurnIcon = ImageFieldName.valueForString(example);
example = "locationImage";
ImageFieldName enumLocationImage = ImageFieldName.valueForString(example);
example = "secondaryGraphic";
ImageFieldName enumSecondaryGraphic = ImageFieldName.valueForString(example);
assertNotNull("softButtonImage returned null", enumSoftButtonImage);
assertNotNull("choiceImage returned null", enumChoiceImage);
assertNotNull("choiceSecondaryImage returned null", enumSecondaryImage);
assertNotNull("vrHelpItem returned null", enumVrHelpItem);
assertNotNull("turnIcon returned null", enumTurnIcon);
assertNotNull("menuIcon returned null", enumMenuIcon);
assertNotNull("cmdIcon returned null", enumCmdIcon);
assertNotNull("appIcon returned null", enumAppIcon);
assertNotNull("graphic returned null", enumGraphicIcon);
assertNotNull("showConstantTBTIcon returned null", enumShowConstantTbtIcon);
assertNotNull("showConstantTBTNextTurnIcon returned null", enumShowConstantTbtNextTurnIcon);
assertNotNull("location image returned null", enumLocationImage);
assertNotNull("secondary graphic returned null", enumSecondaryGraphic);
}
/**
* Verifies that an invalid assignment is null.
*/
public void testInvalidEnum () {
String example = "sofTbUtTOnImagE";
try {
ImageFieldName temp = ImageFieldName.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
}
catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
}
}
/**
* Verifies that a null assignment is invalid.
*/
public void testNullEnum () {
String example = null;
try {
ImageFieldName temp = ImageFieldName.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
}
catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
}
}
/**
* Verifies the possible enum values of ImageFieldName.
*/
public void testListEnum() {
List<ImageFieldName> enumValueList = Arrays.asList(ImageFieldName.values());
List<ImageFieldName> enumTestList = new ArrayList<ImageFieldName>();
enumTestList.add(ImageFieldName.softButtonImage);
enumTestList.add(ImageFieldName.choiceImage);
enumTestList.add(ImageFieldName.choiceSecondaryImage);
enumTestList.add(ImageFieldName.vrHelpItem);
enumTestList.add(ImageFieldName.turnIcon);
enumTestList.add(ImageFieldName.menuIcon);
enumTestList.add(ImageFieldName.cmdIcon);
enumTestList.add(ImageFieldName.appIcon);
enumTestList.add(ImageFieldName.graphic);
enumTestList.add(ImageFieldName.showConstantTBTIcon);
enumTestList.add(ImageFieldName.showConstantTBTNextTurnIcon);
enumTestList.add(ImageFieldName.locationImage);
enumTestList.add(ImageFieldName.secondaryGraphic);
enumTestList.add(ImageFieldName.alertIcon);
enumTestList.add(ImageFieldName.subtleAlertIcon);
enumTestList.add(ImageFieldName.subMenuIcon);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}
}
|