fix lint issues
This commit is contained in:
parent
e51b31a5e6
commit
d94df30ddf
3 changed files with 10 additions and 24 deletions
|
@ -58,11 +58,9 @@ public class NewFeedTests {
|
||||||
//reset(((TestApiProvider)mApi).networkRequestSpy);
|
//reset(((TestApiProvider)mApi).networkRequestSpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addNewFeed_New_sameActivity() {
|
public void addNewFeed_New_sameActivity() {
|
||||||
String feed = "http://test.de/new";
|
String feed = TestApiProvider.NEW_FEED_SUCCESS;
|
||||||
|
|
||||||
// Type text and then press the button.
|
// Type text and then press the button.
|
||||||
onView(withId(R.id.et_feed_url)).perform(typeText(feed), closeSoftKeyboard());
|
onView(withId(R.id.et_feed_url)).perform(typeText(feed), closeSoftKeyboard());
|
||||||
|
@ -83,7 +81,7 @@ public class NewFeedTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addNewFeed_Existing_sameActivity() {
|
public void addNewFeed_Existing_sameActivity() {
|
||||||
String feed = "http://test.de/existing";
|
String feed = TestApiProvider.NEW_FEED_EXISTING;
|
||||||
|
|
||||||
// Type text and then press the button.
|
// Type text and then press the button.
|
||||||
onView(withId(R.id.et_feed_url)).perform(typeText(feed), closeSoftKeyboard());
|
onView(withId(R.id.et_feed_url)).perform(typeText(feed), closeSoftKeyboard());
|
||||||
|
@ -104,7 +102,7 @@ public class NewFeedTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addNewFeed_Invalid_sameActivity() {
|
public void addNewFeed_Invalid_sameActivity() {
|
||||||
String feed = "http://test.de/fail";
|
String feed = TestApiProvider.NEW_FEED_FAIL;
|
||||||
|
|
||||||
// Type text and then press the button.
|
// Type text and then press the button.
|
||||||
onView(withId(R.id.et_feed_url)).perform(typeText(feed), closeSoftKeyboard());
|
onView(withId(R.id.et_feed_url)).perform(typeText(feed), closeSoftKeyboard());
|
||||||
|
|
|
@ -5,31 +5,18 @@ import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
import com.nextcloud.android.sso.AccountImporter;
|
import com.nextcloud.android.sso.AccountImporter;
|
||||||
import com.nextcloud.android.sso.api.NextcloudAPI;
|
|
||||||
import com.nextcloud.android.sso.helper.SingleAccountHelper;
|
import com.nextcloud.android.sso.helper.SingleAccountHelper;
|
||||||
import com.nextcloud.android.sso.model.SingleSignOnAccount;
|
import com.nextcloud.android.sso.model.SingleSignOnAccount;
|
||||||
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.mockito.stubbing.Answer;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||||
import de.luhmer.owncloudnewsreader.database.model.Feed;
|
|
||||||
import de.luhmer.owncloudnewsreader.helper.GsonConfig;
|
|
||||||
import de.luhmer.owncloudnewsreader.reader.nextcloud.API;
|
|
||||||
import de.luhmer.owncloudnewsreader.ssl.MemorizingTrustManager;
|
import de.luhmer.owncloudnewsreader.ssl.MemorizingTrustManager;
|
||||||
import okhttp3.ResponseBody;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Matchers.anyInt;
|
import static org.mockito.Matchers.anyInt;
|
||||||
import static org.mockito.Matchers.anyString;
|
import static org.mockito.Matchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,15 @@ import static org.mockito.ArgumentMatchers.any;
|
||||||
|
|
||||||
public class TestApiProvider extends ApiProvider {
|
public class TestApiProvider extends ApiProvider {
|
||||||
|
|
||||||
|
|
||||||
private static final String TAG = TestApiProvider.class.getCanonicalName();
|
private static final String TAG = TestApiProvider.class.getCanonicalName();
|
||||||
|
|
||||||
|
public static final String NEW_FEED_SUCCESS = "http://test.de/new";
|
||||||
|
public static final String NEW_FEED_EXISTING = "http://test.de/existing";
|
||||||
|
public static final String NEW_FEED_FAIL = "http://test.de/fail";
|
||||||
|
private static final String NEW_FEED_EXISTING_ERROR_MESSAGE = "{\"message\":\"Feed konnte nicht hinzugef\\u00fcgt werden: Existiert bereits\"}";
|
||||||
|
private static final String NEW_FEED_FAIL_ERROR_MESSAGE = "{\"message\":\"FeedIo\\\\Adapter\\\\NotFoundException: Client error: `GET http:\\/\\/feeds2.feedburner.com\\/stadt-bremerhaven\\/dqXM222` resulted in a `404 Feed not found error: FeedBurner cannot locate this feed URI.` response:\\n\\u003Chtml\\u003E\\n\\u003Chead\\u003E\\n\\u003Cstyle type=\\\"text\\/css\\\"\\u003E\\na:link, a:visited {\\n color: #000099;\\n text-decoration: underline;\\n}\\n\\na:hover {\\n (truncated...)\\n in \\/apps2\\/news\\/lib\\/Fetcher\\/Client\\/FeedIoClient.php:57\\nStack trace:\\n#0 \\/apps2\\/news\\/vendor\\/debril\\/feed-io\\/src\\/FeedIo\\/Reader.php(116): OCA\\\\News\\\\Fetcher\\\\Client\\\\FeedIoClient-\\u003EgetResponse('http:\\/\\/feeds2.f...', Object(DateTime))\\n#1 \\/apps2\\/news\\/vendor\\/debril\\/feed-io\\/src\\/FeedIo\\/FeedIo.php(286): FeedIo\\\\Reader-\\u003Eread('http:\\/\\/feeds2.f...', Object(FeedIo\\\\Feed), Object(DateTime))\\n#2 \\/apps2\\/news\\/lib\\/Fetcher\\/FeedFetcher.php(77): FeedIo\\\\FeedIo-\\u003Eread('http:\\/\\/feeds2.f...')\\n#3 \\/apps2\\/news\\/lib\\/Fetcher\\/Fetcher.php(68): OCA\\\\News\\\\Fetcher\\\\FeedFetcher-\\u003Efetch('http:\\/\\/feeds2.f...', true, NULL, NULL, NULL)\\n#4 \\/apps2\\/news\\/lib\\/Service\\/FeedService.php(116): OCA\\\\News\\\\Fetcher\\\\Fetcher-\\u003Efetch('http:\\/\\/feeds2.f...', true, NULL, NULL, NULL)\\n#5 \\/apps2\\/news\\/lib\\/Controller\\/FeedApiController.php(96): OCA\\\\News\\\\Service\\\\FeedService-\\u003Ecreate('http:\\/\\/feeds2.f...', 0, 'david')\\n#6 \\/nextcloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php(166): OCA\\\\News\\\\Controller\\\\FeedApiController-\\u003Ecreate('http:\\/\\/feeds2.f...', 0)\\n#7 \\/nextcloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher-\\u003EexecuteController(Object(OCA\\\\News\\\\Controller\\\\FeedApiController), 'create')\\n#8 \\/nextcloud\\/lib\\/private\\/AppFramework\\/App.php(118): OC\\\\AppFramework\\\\Http\\\\Dispatcher-\\u003Edispatch(Object(OCA\\\\News\\\\Controller\\\\FeedApiController), 'create')\\n#9 \\/nextcloud\\/lib\\/private\\/AppFramework\\/Routing\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('OCA\\\\\\\\News\\\\\\\\Contro...', 'create', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#10 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler-\\u003E__invoke(Array)\\n#11 \\/nextcloud\\/lib\\/private\\/Route\\/Router.php(297): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#12 \\/nextcloud\\/lib\\/base.php(987): OC\\\\Route\\\\Router-\\u003Ematch('\\/apps\\/news\\/api\\/...')\\n#13 \\/nextcloud\\/index.php(42): OC::handleRequest()\\n#14 {main}\"}";
|
||||||
|
|
||||||
|
|
||||||
public NewsTestNetworkRequest networkRequestSpy;
|
public NewsTestNetworkRequest networkRequestSpy;
|
||||||
|
|
||||||
TestApiProvider(MemorizingTrustManager mtm, SharedPreferences sp, Context context) {
|
TestApiProvider(MemorizingTrustManager mtm, SharedPreferences sp, Context context) {
|
||||||
|
@ -82,11 +88,6 @@ public class TestApiProvider extends ApiProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final String NEW_FEED_SUCCESS = "http://test.de/new";
|
|
||||||
private final String NEW_FEED_EXISTING = "http://test.de/existing";
|
|
||||||
private final String NEW_FEED_FAIL = "http://test.de/fail";
|
|
||||||
private final String NEW_FEED_EXISTING_ERROR_MESSAGE = "{\"message\":\"Feed konnte nicht hinzugef\\u00fcgt werden: Existiert bereits\"}";
|
|
||||||
private final String NEW_FEED_FAIL_ERROR_MESSAGE = "{\"message\":\"FeedIo\\\\Adapter\\\\NotFoundException: Client error: `GET http:\\/\\/feeds2.feedburner.com\\/stadt-bremerhaven\\/dqXM222` resulted in a `404 Feed not found error: FeedBurner cannot locate this feed URI.` response:\\n\\u003Chtml\\u003E\\n\\u003Chead\\u003E\\n\\u003Cstyle type=\\\"text\\/css\\\"\\u003E\\na:link, a:visited {\\n color: #000099;\\n text-decoration: underline;\\n}\\n\\na:hover {\\n (truncated...)\\n in \\/apps2\\/news\\/lib\\/Fetcher\\/Client\\/FeedIoClient.php:57\\nStack trace:\\n#0 \\/apps2\\/news\\/vendor\\/debril\\/feed-io\\/src\\/FeedIo\\/Reader.php(116): OCA\\\\News\\\\Fetcher\\\\Client\\\\FeedIoClient-\\u003EgetResponse('http:\\/\\/feeds2.f...', Object(DateTime))\\n#1 \\/apps2\\/news\\/vendor\\/debril\\/feed-io\\/src\\/FeedIo\\/FeedIo.php(286): FeedIo\\\\Reader-\\u003Eread('http:\\/\\/feeds2.f...', Object(FeedIo\\\\Feed), Object(DateTime))\\n#2 \\/apps2\\/news\\/lib\\/Fetcher\\/FeedFetcher.php(77): FeedIo\\\\FeedIo-\\u003Eread('http:\\/\\/feeds2.f...')\\n#3 \\/apps2\\/news\\/lib\\/Fetcher\\/Fetcher.php(68): OCA\\\\News\\\\Fetcher\\\\FeedFetcher-\\u003Efetch('http:\\/\\/feeds2.f...', true, NULL, NULL, NULL)\\n#4 \\/apps2\\/news\\/lib\\/Service\\/FeedService.php(116): OCA\\\\News\\\\Fetcher\\\\Fetcher-\\u003Efetch('http:\\/\\/feeds2.f...', true, NULL, NULL, NULL)\\n#5 \\/apps2\\/news\\/lib\\/Controller\\/FeedApiController.php(96): OCA\\\\News\\\\Service\\\\FeedService-\\u003Ecreate('http:\\/\\/feeds2.f...', 0, 'david')\\n#6 \\/nextcloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php(166): OCA\\\\News\\\\Controller\\\\FeedApiController-\\u003Ecreate('http:\\/\\/feeds2.f...', 0)\\n#7 \\/nextcloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher-\\u003EexecuteController(Object(OCA\\\\News\\\\Controller\\\\FeedApiController), 'create')\\n#8 \\/nextcloud\\/lib\\/private\\/AppFramework\\/App.php(118): OC\\\\AppFramework\\\\Http\\\\Dispatcher-\\u003Edispatch(Object(OCA\\\\News\\\\Controller\\\\FeedApiController), 'create')\\n#9 \\/nextcloud\\/lib\\/private\\/AppFramework\\/Routing\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('OCA\\\\\\\\News\\\\\\\\Contro...', 'create', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#10 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler-\\u003E__invoke(Array)\\n#11 \\/nextcloud\\/lib\\/private\\/Route\\/Router.php(297): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#12 \\/nextcloud\\/lib\\/base.php(987): OC\\\\Route\\\\Router-\\u003Ematch('\\/apps\\/news\\/api\\/...')\\n#13 \\/nextcloud\\/index.php(42): OC::handleRequest()\\n#14 {main}\"}";
|
|
||||||
|
|
||||||
// https://github.com/nextcloud/news/blob/master/docs/externalapi/Legacy.md#create-a-feed
|
// https://github.com/nextcloud/news/blob/master/docs/externalapi/Legacy.md#create-a-feed
|
||||||
private InputStream handleCreateFeed(NextcloudRequest request) throws NextcloudHttpRequestFailedException {
|
private InputStream handleCreateFeed(NextcloudRequest request) throws NextcloudHttpRequestFailedException {
|
||||||
|
|
Loading…
Reference in a new issue