当前位置: 首页>>代码示例>>Java>>正文


Java AppHMIType.valueForString方法代码示例

本文整理汇总了Java中com.smartdevicelink.proxy.rpc.enums.AppHMIType.valueForString方法的典型用法代码示例。如果您正苦于以下问题:Java AppHMIType.valueForString方法的具体用法?Java AppHMIType.valueForString怎么用?Java AppHMIType.valueForString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.smartdevicelink.proxy.rpc.enums.AppHMIType的用法示例。


在下文中一共展示了AppHMIType.valueForString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testValidEnums

import com.smartdevicelink.proxy.rpc.enums.AppHMIType; //导入方法依赖的package包/类
/**
 * Verifies that the enum values are not null upon valid assignment.
 */
public void testValidEnums () {	
	String example = "DEFAULT";
	AppHMIType enumDefault = AppHMIType.valueForString(example);
	example = "COMMUNICATION";
	AppHMIType enumCommunication = AppHMIType.valueForString(example);
	example = "MEDIA";
	AppHMIType enumMedia = AppHMIType.valueForString(example);
	example = "MESSAGING";
	AppHMIType enumMessaging = AppHMIType.valueForString(example);
	example = "NAVIGATION";
	AppHMIType enumNavigation = AppHMIType.valueForString(example);
	example = "INFORMATION";
	AppHMIType enumInformation = AppHMIType.valueForString(example);
	example = "SOCIAL";
	AppHMIType enumSocial = AppHMIType.valueForString(example);
	example = "BACKGROUND_PROCESS";
	AppHMIType enumBackgroundProcess = AppHMIType.valueForString(example);
	example = "PROJECTION";
	AppHMIType enumProjection = AppHMIType.valueForString(example);
	example = "TESTING";
	AppHMIType enumTesting = AppHMIType.valueForString(example);
	example = "SYSTEM";
	AppHMIType enumSystem = AppHMIType.valueForString(example);
	example = "REMOTE_CONTROL";
	AppHMIType enumRemoteControl = AppHMIType.valueForString(example);
	
	assertNotNull("DEFAULT returned null", enumDefault);
	assertNotNull("COMMUNICATION returned null", enumCommunication);
	assertNotNull("MEDIA returned null", enumMedia);
	assertNotNull("MESSAGING returned null", enumMessaging);
	assertNotNull("NAVIGATION returned null", enumNavigation);
	assertNotNull("INFORMATION returned null", enumInformation);
	assertNotNull("SOCIAL returned null", enumSocial);
	assertNotNull("BACKGROUND_PROCESS returned null", enumBackgroundProcess);
	assertNotNull("PROJECTION returned null", enumProjection);
	assertNotNull("TESTING returned null", enumTesting);
	assertNotNull("SYSTEM returned null", enumSystem);
	assertNotNull("REMOTE_CONTROL returned null", enumRemoteControl);
}
 
开发者ID:smartdevicelink,项目名称:sdl_android,代码行数:43,代码来源:AppHmiTypeTests.java

示例2: testInvalidEnum

import com.smartdevicelink.proxy.rpc.enums.AppHMIType; //导入方法依赖的package包/类
/**
 * Verifies that an invalid assignment is null.
 */
public void testInvalidEnum () {
	String example = "deFaUlt";
	try {
	    AppHMIType temp = AppHMIType.valueForString(example);
           assertNull("Result of valueForString should be null.", temp);
	}
	catch (IllegalArgumentException exception) {
           fail("Invalid enum throws IllegalArgumentException.");
	}
}
 
开发者ID:smartdevicelink,项目名称:sdl_android,代码行数:14,代码来源:AppHmiTypeTests.java

示例3: testNullEnum

import com.smartdevicelink.proxy.rpc.enums.AppHMIType; //导入方法依赖的package包/类
/**
 * Verifies that a null assignment is invalid.
 */
public void testNullEnum () {
	String example = null;
	try {
	    AppHMIType temp = AppHMIType.valueForString(example);
           assertNull("Result of valueForString should be null.", temp);
	}
	catch (NullPointerException exception) {
           fail("Null string throws NullPointerException.");
	}
}
 
开发者ID:smartdevicelink,项目名称:sdl_android,代码行数:14,代码来源:AppHmiTypeTests.java

示例4: testJsonConstructor

import com.smartdevicelink.proxy.rpc.enums.AppHMIType; //导入方法依赖的package包/类
/**
   * Tests a valid JSON construction of this RPC message.
   */
  public void testJsonConstructor () {
  	JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
  	assertNotNull(Test.NOT_NULL, commandJson);
  	
try {
	Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
	RegisterAppInterface cmd = new RegisterAppInterface(hash);
	
	JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
	assertNotNull(Test.NOT_NULL, body);
	
	// Test everything in the json body.
	assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
	assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());

	JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
	JSONArray ttsNameArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterface.KEY_TTS_NAME);
	List<TTSChunk> ttsNameList = new ArrayList<TTSChunk>();
	for (int index = 0; index < ttsNameArray.length(); index++) {
       	TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsNameArray.get(index)) );
       	ttsNameList.add(chunk);
	}
	assertTrue(Test.TRUE,  Validator.validateTtsChunks(ttsNameList, cmd.getTtsName()));
	assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HMI_DISPLAY_LANGUAGE_DESIRED), cmd.getHmiDisplayLanguageDesired().toString());
	
	JSONArray appHmiTypeArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterface.KEY_APP_HMI_TYPE);
	for (int index = 0; index < appHmiTypeArray.length(); index++) {
		AppHMIType appHmiTypeItem = AppHMIType.valueForString( appHmiTypeArray.get(index).toString() );
		assertEquals(Test.MATCH, appHmiTypeItem, cmd.getAppHMIType().get(index) );
	}
	assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_ID), cmd.getAppID());
	assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_LANGUAGE_DESIRED), cmd.getLanguageDesired().toString());
	
	JSONObject deviceInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DEVICE_INFO);
	DeviceInfo deviceInfo = new DeviceInfo(JsonRPCMarshaller.deserializeJSONObject(deviceInfoObj));
	assertTrue(Test.TRUE,  Validator.validateDeviceInfo(deviceInfo, cmd.getDeviceInfo()) );
	assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_NAME), cmd.getAppName());
	assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME), cmd.getNgnMediaScreenAppName());
	assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, RegisterAppInterface.KEY_IS_MEDIA_APPLICATION), cmd.getIsMediaApplication());

	List<String> vrSynonymsList = JsonUtils.readStringListFromJsonObject(parameters, RegisterAppInterface.KEY_VR_SYNONYMS);
	List<String> testSynonymsList = cmd.getVrSynonyms();
	assertEquals(Test.MATCH, vrSynonymsList.size(), testSynonymsList.size());
	assertTrue(Test.TRUE, Validator.validateStringList(vrSynonymsList, testSynonymsList));
	
	JSONObject sdlMsgVersionObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_SDL_MSG_VERSION);
	SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(JsonRPCMarshaller.deserializeJSONObject(sdlMsgVersionObj));
	assertTrue(Test.TRUE,  Validator.validateSdlMsgVersion(sdlMsgVersion, cmd.getSdlMsgVersion()) );
	assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HASH_ID), cmd.getHashID());
} catch (JSONException e) {
	fail(Test.JSON_FAIL);
}    	
  }
 
开发者ID:smartdevicelink,项目名称:sdl_android,代码行数:57,代码来源:RegisterAppInterfaceTests.java


注:本文中的com.smartdevicelink.proxy.rpc.enums.AppHMIType.valueForString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。