本文整理汇总了Java中com.smartdevicelink.proxy.rpc.enums.SystemAction.valueForString方法的典型用法代码示例。如果您正苦于以下问题:Java SystemAction.valueForString方法的具体用法?Java SystemAction.valueForString怎么用?Java SystemAction.valueForString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.smartdevicelink.proxy.rpc.enums.SystemAction
的用法示例。
在下文中一共展示了SystemAction.valueForString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testValidEnums
import com.smartdevicelink.proxy.rpc.enums.SystemAction; //导入方法依赖的package包/类
/**
* Verifies that the enum values are not null upon valid assignment.
*/
public void testValidEnums () {
String example = "DEFAULT_ACTION";
SystemAction enumDefaultAction = SystemAction.valueForString(example);
example = "STEAL_FOCUS";
SystemAction enumStealFocus = SystemAction.valueForString(example);
example = "KEEP_CONTEXT";
SystemAction enumKeepContext = SystemAction.valueForString(example);
assertNotNull("DEFAULT_ACTION returned null", enumDefaultAction);
assertNotNull("STEAL_FOCUS returned null", enumStealFocus);
assertNotNull("KEEP_CONTEXT returned null", enumKeepContext);
}
示例2: testInvalidEnum
import com.smartdevicelink.proxy.rpc.enums.SystemAction; //导入方法依赖的package包/类
/**
* Verifies that an invalid assignment is null.
*/
public void testInvalidEnum () {
String example = "deFaulT_ActiON";
try {
SystemAction temp = SystemAction.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
}
catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
}
}
示例3: testNullEnum
import com.smartdevicelink.proxy.rpc.enums.SystemAction; //导入方法依赖的package包/类
/**
* Verifies that a null assignment is invalid.
*/
public void testNullEnum () {
String example = null;
try {
SystemAction temp = SystemAction.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
}
catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
}
}