Fix lint issues / Cadacy issue

This commit is contained in:
David Luhmer 2019-04-05 22:34:40 -03:00
parent d94df30ddf
commit ef61ce4986
3 changed files with 11 additions and 13 deletions

View file

@ -46,7 +46,7 @@ public class NewFeedTests {
@Rule
public ActivityTestRule<NewFeedActivity> activityRule = new ActivityTestRule<>(NewFeedActivity.class);
@Inject ApiProvider mApi;
protected @Inject ApiProvider mApi;
@Before
public void setUp() {
@ -59,7 +59,7 @@ public class NewFeedTests {
}
@Test
public void addNewFeed_New_sameActivity() {
public void addNewFeed() {
String feed = TestApiProvider.NEW_FEED_SUCCESS;
// Type text and then press the button.
@ -80,7 +80,7 @@ public class NewFeedTests {
}
@Test
public void addNewFeed_Existing_sameActivity() {
public void addExistingFeed() {
String feed = TestApiProvider.NEW_FEED_EXISTING;
// Type text and then press the button.
@ -101,7 +101,7 @@ public class NewFeedTests {
}
@Test
public void addNewFeed_Invalid_sameActivity() {
public void addInvalidFeed() {
String feed = TestApiProvider.NEW_FEED_FAIL;
// Type text and then press the button.

View file

@ -69,12 +69,8 @@ public class TestApiModule extends ApiModule {
}
@Override
ApiProvider provideAPI(MemorizingTrustManager mtm, SharedPreferences sp) {
protected ApiProvider provideAPI(MemorizingTrustManager mtm, SharedPreferences sp) {
ApiProvider apiProvider = new TestApiProvider(mtm, sp, application);
return apiProvider;
}
}

View file

@ -76,13 +76,14 @@ public class TestApiProvider extends ApiProvider {
throw new NetworkOnMainThreadException();
}
Log.e(TAG, "Requested URL: " + request.getUrl());
InputStream inputStream = null;
Log.w(TAG, "Requested URL: " + request.getUrl());
InputStream inputStream;
switch (request.getUrl()) {
case "/index.php/apps/news/api/v1-2/feeds":
inputStream = handleCreateFeed(request);
break;
default:
throw new UnsupportedOperationException("Not implemented yet!");
}
return inputStream;
}
@ -98,8 +99,9 @@ public class TestApiProvider extends ApiProvider {
throw new NextcloudHttpRequestFailedException(409, new Throwable(NEW_FEED_EXISTING_ERROR_MESSAGE));
case NEW_FEED_FAIL:
throw new NextcloudHttpRequestFailedException(422, new Throwable(NEW_FEED_FAIL_ERROR_MESSAGE));
default:
throw new UnsupportedOperationException("Not implemented yet!");
}
return null;
}
private InputStream stringToInputStream(String data) {