diff options
15 files changed, 5 insertions, 57 deletions
diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/api/ResponseCallbackTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/api/ResponseCallbackTest.java index 083be6c82..47e1bcedf 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/api/ResponseCallbackTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/api/ResponseCallbackTest.java @@ -1,11 +1,8 @@ package it.niedermann.nextcloud.deck.api; -import android.os.Build; - import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.util.Arrays; import java.util.List; @@ -25,7 +22,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class ResponseCallbackTest { @Test diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManagerTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManagerTest.java index b4fcb7316..a22e24d29 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManagerTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManagerTest.java @@ -2,7 +2,6 @@ package it.niedermann.nextcloud.deck.persistence.sync; import android.accounts.NetworkErrorException; import android.content.Context; -import android.os.Build; import androidx.annotation.NonNull; import androidx.arch.core.executor.testing.InstantTaskExecutorRule; @@ -20,7 +19,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -74,7 +72,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class SyncManagerTest { @Rule diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapterTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapterTest.java index d8e7ee83e..5bbcc4e17 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapterTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapterTest.java @@ -1,7 +1,6 @@ package it.niedermann.nextcloud.deck.persistence.sync.adapters.db; import android.content.Context; -import android.os.Build; import androidx.room.Room; import androidx.test.core.app.ApplicationProvider; @@ -13,7 +12,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -37,7 +35,6 @@ import static it.niedermann.nextcloud.deck.persistence.sync.adapters.db.DeckData import static org.junit.Assert.assertEquals; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class DataBaseAdapterTest { private DeckDatabase db; @@ -86,7 +83,7 @@ public class DataBaseAdapterTest { fillSqlWithListValues.setAccessible(true); fillSqlWithListValues.invoke(adapter, builder, args, entities); assertEquals("?", builder.toString()); - assertEquals(user.getLocalId(), ((IRemoteEntity)args.get(0)).getLocalId()); + assertEquals(user.getLocalId(), ((IRemoteEntity) args.get(0)).getLocalId()); } @Test @@ -105,6 +102,7 @@ public class DataBaseAdapterTest { assertEquals("?", builder.toString()); assertEquals(leet, args.get(0)); } + @Test public void testFillSqlWithMultipleListValues() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { final User user = createUser(db.getUserDao(), createAccount(db.getAccountDao())); @@ -113,7 +111,7 @@ public class DataBaseAdapterTest { final Long leet = 1337L; final List<?> entities = new ArrayList<Long>(2) {{ add(leet); - add(leet+1); + add(leet + 1); }}; final Method fillSqlWithListValues = DataBaseAdapter.class.getDeclaredMethod("fillSqlWithListValues", StringBuilder.class, Collection.class, List.class); @@ -121,7 +119,7 @@ public class DataBaseAdapterTest { fillSqlWithListValues.invoke(adapter, builder, args, entities); assertEquals("?, ?", builder.toString()); assertEquals(leet, args.get(0)); - assertEquals(leet+1, args.get(1)); + assertEquals(leet + 1, args.get(1)); } } diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AbstractDaoTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AbstractDaoTest.java index 566791669..fb0282d84 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AbstractDaoTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AbstractDaoTest.java @@ -1,7 +1,5 @@ package it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao; -import android.os.Build; - import androidx.arch.core.executor.testing.InstantTaskExecutorRule; import androidx.room.Room; import androidx.test.core.app.ApplicationProvider; @@ -11,12 +9,10 @@ import org.junit.Before; import org.junit.Rule; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import it.niedermann.nextcloud.deck.persistence.sync.adapters.db.DeckDatabase; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public abstract class AbstractDaoTest { @Rule diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AccountDaoTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AccountDaoTest.java index 51be257c2..a65756df3 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AccountDaoTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AccountDaoTest.java @@ -1,11 +1,8 @@ package it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao; -import android.os.Build; - import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import it.niedermann.nextcloud.deck.model.Account; import it.niedermann.nextcloud.deck.model.ocs.Capabilities; @@ -16,7 +13,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class AccountDaoTest extends AbstractDaoTest { @Test diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/BoardDaoTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/BoardDaoTest.java index f63775485..e87fb06df 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/BoardDaoTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/BoardDaoTest.java @@ -1,11 +1,8 @@ package it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao; -import android.os.Build; - import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.time.Instant; import java.util.List; @@ -28,7 +25,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class BoardDaoTest extends AbstractDaoTest { @Test diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDaoTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDaoTest.java index a3401de42..a6cb086ce 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDaoTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDaoTest.java @@ -1,12 +1,9 @@ package it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao; -import android.os.Build; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.util.List; @@ -24,7 +21,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class CardDaoTest extends AbstractDaoTest { private Account account; diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/StackDaoTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/StackDaoTest.java index 6bc5d32b7..2589ade36 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/StackDaoTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/StackDaoTest.java @@ -1,11 +1,8 @@ package it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao; -import android.os.Build; - import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.util.List; @@ -19,7 +16,6 @@ import it.niedermann.nextcloud.deck.persistence.sync.adapters.db.DeckDatabaseTes import static org.junit.Assert.assertEquals; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class StackDaoTest extends AbstractDaoTest { @Test diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/UserDaoTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/UserDaoTest.java index edb5d8181..33d0a730a 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/UserDaoTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/UserDaoTest.java @@ -1,11 +1,8 @@ package it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao; -import android.os.Build; - import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import it.niedermann.nextcloud.deck.model.Account; import it.niedermann.nextcloud.deck.model.User; @@ -14,7 +11,6 @@ import it.niedermann.nextcloud.deck.persistence.sync.adapters.db.DeckDatabaseTes import static org.junit.Assert.assertEquals; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class UserDaoTest extends AbstractDaoTest { @Test diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/ui/card/EditCardViewModelTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/ui/card/EditCardViewModelTest.java index 857a28242..b30d0c04b 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/ui/card/EditCardViewModelTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/ui/card/EditCardViewModelTest.java @@ -3,7 +3,6 @@ package it.niedermann.nextcloud.deck.ui.card; import android.content.Context; import android.content.SharedPreferences; -import android.os.Build; import androidx.arch.core.executor.testing.InstantTaskExecutorRule; import androidx.test.core.app.ApplicationProvider; @@ -13,7 +12,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.lang.reflect.Field; @@ -27,7 +25,6 @@ import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class EditCardViewModelTest { @Rule diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/util/AttachmentUtilTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/util/AttachmentUtilTest.java index 2746eaaac..1c617a7ba 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/util/AttachmentUtilTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/util/AttachmentUtilTest.java @@ -1,11 +1,8 @@ package it.niedermann.nextcloud.deck.util; -import android.os.Build; - import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import it.niedermann.nextcloud.deck.model.Account; import it.niedermann.nextcloud.deck.model.Attachment; @@ -14,7 +11,6 @@ import it.niedermann.nextcloud.deck.model.enums.EAttachmentType; import static org.junit.Assert.assertEquals; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class AttachmentUtilTest { @Test @@ -51,7 +47,7 @@ public class AttachmentUtilTest { final Attachment attachment4 = new Attachment(); attachment4.setId(111L); attachment4.setFileId(222L); - final String thumbnailUrl4 = AttachmentUtil.getThumbnailUrl(accountThatDoesNotSupportFileAttachments,333L, attachment4, 444); + final String thumbnailUrl4 = AttachmentUtil.getThumbnailUrl(accountThatDoesNotSupportFileAttachments, 333L, attachment4, 444); // ... a fallback to the attachment itself should be returned assertEquals("https://example.com/index.php/apps/deck/cards/333/attachment/111", thumbnailUrl4); } diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/util/CardUtilTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/util/CardUtilTest.java index 1e82a9436..c46af365e 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/util/CardUtilTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/util/CardUtilTest.java @@ -1,7 +1,6 @@ package it.niedermann.nextcloud.deck.util; import android.content.Context; -import android.os.Build; import androidx.test.core.app.ApplicationProvider; @@ -10,7 +9,6 @@ import com.google.common.collect.Lists; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -29,7 +27,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class CardUtilTest { @Test diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/util/DateUtilTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/util/DateUtilTest.java index 742a7a8b9..b010ef42b 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/util/DateUtilTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/util/DateUtilTest.java @@ -1,14 +1,12 @@ package it.niedermann.nextcloud.deck.util; import android.content.Context; -import android.os.Build; import androidx.test.core.app.ApplicationProvider; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.time.Duration; import java.time.ZoneId; @@ -18,7 +16,6 @@ import java.util.stream.Stream; import static org.junit.Assert.assertEquals; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class DateUtilTest { @Test diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/util/DeckColorUtilTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/util/DeckColorUtilTest.java index 986ebcf52..91b8e16e5 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/util/DeckColorUtilTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/util/DeckColorUtilTest.java @@ -1,14 +1,12 @@ package it.niedermann.nextcloud.deck.util; import android.graphics.Color; -import android.os.Build; import androidx.core.util.Pair; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import java.util.ArrayList; import java.util.List; @@ -17,7 +15,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class DeckColorUtilTest { @Test diff --git a/app/src/test/java/it/niedermann/nextcloud/deck/util/SpannableUtilTest.java b/app/src/test/java/it/niedermann/nextcloud/deck/util/SpannableUtilTest.java index cff0f318e..5da23d6e6 100644 --- a/app/src/test/java/it/niedermann/nextcloud/deck/util/SpannableUtilTest.java +++ b/app/src/test/java/it/niedermann/nextcloud/deck/util/SpannableUtilTest.java @@ -2,7 +2,6 @@ package it.niedermann.nextcloud.deck.util; import android.content.Context; import android.graphics.Typeface; -import android.os.Build; import android.text.SpannableString; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; @@ -13,12 +12,10 @@ import androidx.test.core.app.ApplicationProvider; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import static org.junit.Assert.assertEquals; @RunWith(RobolectricTestRunner.class) -@Config(sdk = {Build.VERSION_CODES.P}) public class SpannableUtilTest { @Test |