diff options
author | Joey Grover <joeygrover@gmail.com> | 2018-10-23 17:06:59 -0400 |
---|---|---|
committer | Joey Grover <joeygrover@gmail.com> | 2018-10-23 17:06:59 -0400 |
commit | a3f35a5ecc3b833839c254c05726d1f5574de31c (patch) | |
tree | d6a1b20ef9c93505adb8088755829a9fe59de3c8 | |
parent | 3433ae3348aca52142f5239451ea0e8f471c0e6c (diff) | |
download | sdl_android-a3f35a5ecc3b833839c254c05726d1f5574de31c.tar.gz |
Update tests and hello_sdl for no exception throw
-rwxr-xr-x | hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java | 23 | ||||
-rw-r--r-- | sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java | 20 |
2 files changed, 11 insertions, 32 deletions
diff --git a/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java index 2847a3fd6..ea98cbf7f 100755 --- a/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java +++ b/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java @@ -13,14 +13,12 @@ import android.os.Build; import android.os.IBinder; import android.util.Log; -import com.smartdevicelink.exception.SdlException; import com.smartdevicelink.managers.CompletionListener; import com.smartdevicelink.managers.SdlManager; import com.smartdevicelink.managers.SdlManagerListener; import com.smartdevicelink.managers.file.filetypes.SdlArtwork; import com.smartdevicelink.protocol.enums.FunctionID; import com.smartdevicelink.proxy.RPCNotification; -import com.smartdevicelink.proxy.RPCRequest; import com.smartdevicelink.proxy.TTSChunkFactory; import com.smartdevicelink.proxy.rpc.AddCommand; import com.smartdevicelink.proxy.rpc.MenuParams; @@ -31,11 +29,9 @@ import com.smartdevicelink.proxy.rpc.enums.AppHMIType; import com.smartdevicelink.proxy.rpc.enums.FileType; import com.smartdevicelink.proxy.rpc.enums.HMILevel; import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener; -import com.smartdevicelink.transport.BTTransportConfig; import com.smartdevicelink.transport.BaseTransportConfig; import com.smartdevicelink.transport.MultiplexTransportConfig; import com.smartdevicelink.transport.TCPTransportConfig; -import com.smartdevicelink.transport.USBTransportConfig; import java.util.Collections; import java.util.Vector; @@ -217,14 +213,14 @@ public class SdlService extends Service { command.setCmdID(TEST_COMMAND_ID); command.setMenuParams(params); command.setVrCommands(Collections.singletonList(TEST_COMMAND_NAME)); - sendRpcRequest(command); + sdlManager.sendRPC(command); } /** * Will speak a sample welcome message */ private void performWelcomeSpeak(){ - sendRpcRequest(new Speak(TTSChunkFactory.createSimpleTTSChunks(WELCOME_SPEAK))); + sdlManager.sendRPC(new Speak(TTSChunkFactory.createSimpleTTSChunks(WELCOME_SPEAK))); } /** @@ -256,19 +252,8 @@ public class SdlService extends Service { sdlManager.getScreenManager().setTextField2(""); sdlManager.getScreenManager().commit(null); - sendRpcRequest(new Speak(TTSChunkFactory.createSimpleTTSChunks(TEST_COMMAND_NAME))); + sdlManager.sendRPC(new Speak(TTSChunkFactory.createSimpleTTSChunks(TEST_COMMAND_NAME))); } - /** - * Sends an RPC Request to the connected head unit. Automatically adds a correlation id. - * @param request the rpc request that is to be sent to the module - */ - private void sendRpcRequest(RPCRequest request){ - try { - sdlManager.sendRPC(request); - } catch (SdlException e) { - e.printStackTrace(); - } - } -}
\ No newline at end of file +} diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java index 61626251b..e22e397d2 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java @@ -315,11 +315,8 @@ public class SdlManagerTests extends AndroidTestCase2 { listenerCalledCounter++; } }); - try { - sdlManager.sendRPC(request); - } catch (SdlException e) { - e.printStackTrace(); - } + + sdlManager.sendRPC(request); // Make sure the listener is called exactly once assertEquals("Listener was not called or called more/less frequently than expected", listenerCalledCounter, 1); @@ -375,16 +372,13 @@ public class SdlManagerTests extends AndroidTestCase2 { @Override public void onResponse(int correlationId, RPCResponse response) {} }; - try { - if (sequentialSend) { - sdlManager.sendSequentialRPCs(rpcsList, onMultipleRequestListener); - } else { - sdlManager.sendRPCs(rpcsList, onMultipleRequestListener); - } - } catch (SdlException e) { - e.printStackTrace(); + if (sequentialSend) { + sdlManager.sendSequentialRPCs(rpcsList, onMultipleRequestListener); + } else { + sdlManager.sendRPCs(rpcsList, onMultipleRequestListener); } + // Make sure the listener is called exactly once assertEquals("Listener was not called or called more/less frequently than expected", listenerCalledCounter, 1); } |