From e51b31a5e66c392f4ebdcfe81b289b2a04666d3a Mon Sep 17 00:00:00 2001 From: David Luhmer Date: Fri, 5 Apr 2019 18:49:37 -0300 Subject: [PATCH] cleanup unused test / dependency --- News-Android-App/build.gradle | 2 +- .../owncloudnewsreader/tests/SyncTests.java | 161 ------------------ 2 files changed, 1 insertion(+), 162 deletions(-) delete mode 100644 News-Android-App/src/androidTest/java/de/luhmer/owncloudnewsreader/tests/SyncTests.java diff --git a/News-Android-App/build.gradle b/News-Android-App/build.gradle index 57ded969..11e5e1d6 100644 --- a/News-Android-App/build.gradle +++ b/News-Android-App/build.gradle @@ -185,7 +185,7 @@ dependencies { //androidTestCompile 'com.squareup.okhttp:mockwebserver:2.5.0' // https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver - androidTestImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '3.14.0' + //androidTestImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '3.14.0' androidTestImplementation 'tools.fastlane:screengrab:1.2.0' diff --git a/News-Android-App/src/androidTest/java/de/luhmer/owncloudnewsreader/tests/SyncTests.java b/News-Android-App/src/androidTest/java/de/luhmer/owncloudnewsreader/tests/SyncTests.java deleted file mode 100644 index a10ee1af..00000000 --- a/News-Android-App/src/androidTest/java/de/luhmer/owncloudnewsreader/tests/SyncTests.java +++ /dev/null @@ -1,161 +0,0 @@ -package de.luhmer.owncloudnewsreader.tests; - -import android.os.Bundle; -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.LargeTest; -import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; - -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - -import de.luhmer.owncloudnewsreader.NewsReaderListActivity; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; - -import static androidx.test.InstrumentationRegistry.registerInstance; - -@RunWith(AndroidJUnit4.class) -@LargeTest -public class SyncTests { - - private MockWebServer server; - //private HttpUrl baseUrl; - - @Rule - public ActivityTestRule mActivityRule = new ActivityTestRule<>( - NewsReaderListActivity.class); - - - @Before - public void setUp() throws Exception { - registerInstance(InstrumentationRegistry.getInstrumentation(), new Bundle()); - - // Create a MockWebServer. These are lean enough that you can create a new - // instance for every unit test. - server = new MockWebServer(); - server.start(); - // Ask the server for its URL. You'll need this to make HTTP requests. - //baseUrl = server.url("/"); - - //HttpJsonRequest.init(mActivityRule.getActivity()); - //HttpJsonRequest.getInstance().setCredentials("test", "test", baseUrl.toString()); - } - - - /* - @Test - public void testVersionInfo() throws Exception { - // Schedule some responses. - server.enqueue(new MockResponse().setBody(getSampleVersionInfoV2())); - - String versionNumber = OwnCloudReaderMethods.GetVersionNumber(baseUrl); - assertEquals("5.2.3", versionNumber); - - API api = API.GetRightApiForVersion(versionNumber, baseUrl); - assertTrue(api instanceof APIv2); - } - */ - - private String getSampleVersionInfoV2() { - JsonObject jVer = new JsonObject(); - jVer.addProperty("version", "5.2.3"); - return jVer.toString(); - } - - - /* - @Test - public void testFeedSync() throws Exception { - - JsonObject jFeed = new JsonObject(); - JsonObject jF = new JsonObject(); - jF.addProperty("id", "-1"); - jF.addProperty("url", ""); - jF.addProperty("title", "-1"); - jF.addProperty("faviconLink", "-1"); - jF.addProperty("added", "-1"); - jF.addProperty("folderId", "-1"); - jF.addProperty("ordering", "-1"); //TODO implement this field! - jF.addProperty("link", "-1"); - jF.addProperty("pinned", "-1"); - JsonArray jFeedArr = new JsonArray(); - jFeedArr.add(jF); - jFeed.add("feeds", jFeedArr); - - - server.enqueue(new MockResponse().setBody(getSampleVersionInfoV2())); - server.enqueue(new MockResponse().setBody(jFeed.toString())); - - String versionNumber = OwnCloudReaderMethods.GetVersionNumber(baseUrl); - API api = API.GetRightApiForVersion(versionNumber, baseUrl); - assertTrue(api instanceof APIv2); - - int[] res = OwnCloudReaderMethods.GetFeeds(mActivity, api); - assertEquals(1, res[0]); - assertEquals(1, res[1]); - } - */ - - - @Test - public void testItemSync() { - JsonObject jItem = new JsonObject(); - JsonObject jI = new JsonObject(); - jI.addProperty("id", "-1"); - jI.addProperty("guid", "http://grulja.wordpress.com/?p=76"); - jI.addProperty("guidHash", "3059047a572cd9cd5d0bf645faffd077"); - jI.addProperty("url", "http://grulja.wordpress.com/2013/04/29/plasma-nm-after-the-solid-sprint/"); - jI.addProperty("title", "Plasma-nm after the solid sprint"); - jI.addProperty("author", "Jan Grulich (grulja)"); - jI.addProperty("pubDate", 1367270544); - jI.addProperty("body", "

At first I have to say...

"); - jI.addProperty("enclosureMime", (String) null); - jI.addProperty("enclosureLink", (String) null); - jI.addProperty("feedId", "-1"); - jI.addProperty("unread", true); - jI.addProperty("starred", false); - jI.addProperty("lastModified", 1367273003); - - JsonArray jItemArr = new JsonArray(); - jItemArr.add(jI); - jItem.add("feeds", jItemArr); - - - server.enqueue(new MockResponse().setBody(getSampleVersionInfoV2())); - server.enqueue(new MockResponse().setBody(jItem.toString())); - - /* - String versionNumber = OwnCloudReaderMethods.GetVersionNumber(baseUrl); - API api = API.GetRightApiForVersion(versionNumber, baseUrl); - assertTrue(api instanceof APIv2); - - int res2 = OwnCloudReaderMethods.GetItems(FeedItemTags.ALL, mActivity, "0", true, "0", "0", api); //TODO verify params - assertEquals(1, res2); - */ - } - - @After - public void tearDown() throws Exception { - // Shut down the server. Instances cannot be reused. - server.shutdown(); - } - - - /* - private void sleep(float seconds) { - try { - Thread.sleep((long) seconds * 1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - */ - -} \ No newline at end of file