Skip to content

Commit 542ae05

Browse files
committed
Replace getContext with getTargetContext
1 parent 54fdad4 commit 542ae05

100 files changed

Lines changed: 216 additions & 216 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import java.util.List;
3434
import java.util.Map;
3535

36-
import static android.support.test.InstrumentationRegistry.getContext;
36+
import static android.support.test.InstrumentationRegistry.getTargetContext;
3737
import static junit.framework.TestCase.assertTrue;
3838
import static org.junit.Assert.assertEquals;
3939
import static org.junit.Assert.assertFalse;
@@ -58,7 +58,7 @@ public class FileManagerTests {
5858

5959
@Before
6060
public void setUp() throws Exception{
61-
mTestContext = getContext();
61+
mTestContext = getTargetContext();
6262
validFile = new SdlFile();
6363
validFile.setName(TestValues.GENERAL_STRING);
6464
validFile.setFileData(TestValues.GENERAL_BYTE_ARRAY);

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import static org.mockito.Mockito.doAnswer;
4747
import static org.mockito.Mockito.doReturn;
4848
import static org.mockito.Mockito.mock;
49-
import static android.support.test.InstrumentationRegistry.getContext;
49+
import static android.support.test.InstrumentationRegistry.getTargetContext;
5050

5151
@RunWith(AndroidJUnit4.class)
5252
public class SdlProxyBaseTests {
@@ -60,8 +60,8 @@ public class SdlProxyBaseTests {
6060
@Test
6161
public void testNullSdlProxyConfigurationResources() {
6262
SdlProxyALM proxy = null;
63-
SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getContext());
64-
SdlProxyConfigurationResources config = new SdlProxyConfigurationResources("path", (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE));
63+
SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getTargetContext());
64+
SdlProxyConfigurationResources config = new SdlProxyConfigurationResources("path", (TelephonyManager) getTargetContext().getSystemService(Context.TELEPHONY_SERVICE));
6565
//Construct with a non-null SdlProxyConfigurationResources
6666
builder.setSdlProxyConfigurationResources(config);
6767
try {
@@ -127,14 +127,14 @@ public void testNullSdlProxyConfigurationResources() {
127127
@Test
128128
public void testRemoteDisplayStreaming(){
129129
SdlProxyALM proxy = null;
130-
SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getContext());
130+
SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getTargetContext());
131131
try{
132132
proxy = builder.build();
133133
// public void startRemoteDisplayStream(Context context, final Class<? extends SdlRemoteDisplay> remoteDisplay, final VideoStreamingParameters parameters, final boolean encrypted){
134134
Method m = SdlProxyALM.class.getDeclaredMethod("startRemoteDisplayStream", Context.class, SdlRemoteDisplay.class, VideoStreamingParameters.class, boolean.class);
135135
assertNotNull(m);
136136
m.setAccessible(true);
137-
m.invoke(proxy,getContext(), SdlRemoteDisplayTest.MockRemoteDisplay.class, (VideoStreamingParameters)null, false);
137+
m.invoke(proxy,getTargetContext(), SdlRemoteDisplayTest.MockRemoteDisplay.class, (VideoStreamingParameters)null, false);
138138
assert true;
139139

140140
}catch (Exception e){

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.util.HashMap;
2222
import java.util.List;
2323
import java.util.Map;
24-
import static android.support.test.InstrumentationRegistry.getContext;
24+
import static android.support.test.InstrumentationRegistry.getTargetContext;
2525
import static junit.framework.TestCase.assertTrue;
2626

2727
/**
@@ -61,7 +61,7 @@ public void setUp(){
6161
private Map<String, List<Parameter>> getRPCMandatoryParamsMap(String fileName) {
6262
Map<String, List<Parameter>> rpcMandatoryParamsMap = new HashMap<>();
6363
try {
64-
InputStream stream = getContext().getAssets().open(fileName);
64+
InputStream stream = getTargetContext().getAssets().open(fileName);
6565
XmlPullParserFactory xmlFactoryObject = XmlPullParserFactory.newInstance();
6666
XmlPullParser myParser = xmlFactoryObject.newPullParser();
6767
myParser.setInput(stream, null);

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import java.util.Hashtable;
2020
import java.util.List;
21-
import static android.support.test.InstrumentationRegistry.getContext;
21+
import static android.support.test.InstrumentationRegistry.getTargetContext;
2222
import static junit.framework.TestCase.assertEquals;
2323
import static junit.framework.TestCase.assertNotNull;
2424
import static junit.framework.TestCase.assertTrue;
@@ -108,7 +108,7 @@ public void testRpcValues () {
108108
*/
109109
@Test
110110
public void testJsonConstructor () {
111-
JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
111+
JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
112112
assertNotNull(TestValues.NOT_NULL, commandJson);
113113

114114
try {

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import static junit.framework.TestCase.assertNull;
2424
import static junit.framework.TestCase.assertTrue;
2525
import static junit.framework.TestCase.fail;
26-
import static android.support.test.InstrumentationRegistry.getContext;
26+
import static android.support.test.InstrumentationRegistry.getTargetContext;
2727

2828
/**
2929
* This is a unit test class for the SmartDeviceLink library project class :
@@ -108,7 +108,7 @@ public void testRpcValues () {
108108
*/
109109
@Test
110110
public void testJsonConstructor () {
111-
JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
111+
JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
112112
assertNotNull(TestValues.NOT_NULL, commandJson);
113113

114114
try {

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import static junit.framework.TestCase.assertNull;
2727
import static junit.framework.TestCase.assertTrue;
2828
import static junit.framework.TestCase.fail;
29-
import static android.support.test.InstrumentationRegistry.getContext;
29+
import static android.support.test.InstrumentationRegistry.getTargetContext;
3030

3131
/**
3232
* This is a unit test class for the SmartDeviceLink library project class :
@@ -95,7 +95,7 @@ public void testRpcValues () {
9595
*/
9696
@Test
9797
public void testJsonConstructor () {
98-
JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
98+
JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
9999
assertNotNull(TestValues.NOT_NULL, commandJson);
100100

101101
try {

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import static junit.framework.TestCase.assertNull;
2828
import static junit.framework.TestCase.assertTrue;
2929
import static junit.framework.TestCase.fail;
30-
import static android.support.test.InstrumentationRegistry.getContext;
30+
import static android.support.test.InstrumentationRegistry.getTargetContext;
3131

3232
/**
3333
* This is a unit test class for the SmartDeviceLink library project class :
@@ -136,7 +136,7 @@ public void testRpcValues () {
136136
*/
137137
@Test
138138
public void testJsonConstructor () {
139-
JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
139+
JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
140140
assertNotNull(TestValues.NOT_NULL, commandJson);
141141

142142
try {

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import java.util.Hashtable;
2020

21-
import static android.support.test.InstrumentationRegistry.getContext;
21+
import static android.support.test.InstrumentationRegistry.getTargetContext;
2222
import static junit.framework.TestCase.assertEquals;
2323
import static junit.framework.TestCase.assertNotNull;
2424
import static junit.framework.TestCase.assertNull;
@@ -101,7 +101,7 @@ public void testRpcValues () {
101101
*/
102102
@Test
103103
public void testJsonConstructor () {
104-
JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
104+
JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
105105
assertNotNull(TestValues.NOT_NULL, commandJson);
106106

107107
try {

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
import static junit.framework.TestCase.assertNotNull;
5454
import static junit.framework.TestCase.assertNull;
5555
import static junit.framework.TestCase.fail;
56-
import static android.support.test.InstrumentationRegistry.getContext;
56+
import static android.support.test.InstrumentationRegistry.getTargetContext;
5757

5858
/**
5959
* This is a unit test class for the SmartDeviceLink library project class :
@@ -120,7 +120,7 @@ public void testRpcValues () {
120120
*/
121121
@Test
122122
public void testJsonConstructor () {
123-
JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
123+
JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
124124
assertNotNull(TestValues.NOT_NULL, commandJson);
125125

126126
try {

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import java.util.Hashtable;
1818

19-
import static android.support.test.InstrumentationRegistry.getContext;
19+
import static android.support.test.InstrumentationRegistry.getTargetContext;
2020
import static junit.framework.TestCase.assertEquals;
2121
import static junit.framework.TestCase.assertNotNull;
2222
import static junit.framework.TestCase.assertNull;
@@ -89,7 +89,7 @@ public void testRpcValues () {
8989
*/
9090
@Test
9191
public void testJsonConstructor () {
92-
JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
92+
JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
9393
assertNotNull(TestValues.NOT_NULL, commandJson);
9494

9595
try {

0 commit comments

Comments
 (0)