From ffe41182d12f9651ea18e00f76b352d3dff1f420 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Fri, 24 Jun 2022 13:36:40 +0200 Subject: [PATCH] fix tests Signed-off-by: Andy Scherzinger --- .../nextcloud/talk/activities/MainActivityTest.kt | 12 ++++-------- .../java/com/nextcloud/talk/ui/LoginIT.java | 6 ++---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/src/androidTest/java/com/nextcloud/talk/activities/MainActivityTest.kt b/app/src/androidTest/java/com/nextcloud/talk/activities/MainActivityTest.kt index c57acbabf..3ee4a6d32 100644 --- a/app/src/androidTest/java/com/nextcloud/talk/activities/MainActivityTest.kt +++ b/app/src/androidTest/java/com/nextcloud/talk/activities/MainActivityTest.kt @@ -1,9 +1,9 @@ package com.nextcloud.talk.activities import androidx.test.espresso.intent.rule.IntentsTestRule -import com.nextcloud.talk.data.user.model.UserNgEntity +import com.nextcloud.talk.data.user.model.User import com.nextcloud.talk.users.UserManager -import io.reactivex.Observer +import io.reactivex.SingleObserver import io.reactivex.disposables.Disposable import org.junit.Assert.fail import org.junit.Rule @@ -35,12 +35,12 @@ class MainActivityTest { certificateAlias = null, externalSignalingServer = null ) - ).subscribe(object : Observer { + ).subscribe(object : SingleObserver { override fun onSubscribe(d: Disposable) { // unused atm } - override fun onNext(user: UserNgEntity) { + override fun onSuccess(user: User) { sut.runOnUiThread { sut.resetConversationsList() } println("User: " + user.id + " / " + user.userId + " / " + user.baseUrl) @@ -49,10 +49,6 @@ class MainActivityTest { override fun onError(e: Throwable) { fail("No user created") } - - override fun onComplete() { - // unused atm - } }) } } diff --git a/app/src/androidTest/java/com/nextcloud/talk/ui/LoginIT.java b/app/src/androidTest/java/com/nextcloud/talk/ui/LoginIT.java index fb849d206..d97af0392 100644 --- a/app/src/androidTest/java/com/nextcloud/talk/ui/LoginIT.java +++ b/app/src/androidTest/java/com/nextcloud/talk/ui/LoginIT.java @@ -29,8 +29,6 @@ import android.os.Bundle; import com.nextcloud.talk.R; import com.nextcloud.talk.activities.MainActivity; -import junit.framework.AssertionFailedError; - import org.junit.Test; import java.util.Objects; @@ -52,7 +50,6 @@ import static androidx.test.espresso.matcher.ViewMatchers.withText; import static androidx.test.espresso.web.sugar.Web.onWebView; import static androidx.test.espresso.web.webdriver.DriverAtoms.findElement; import static androidx.test.espresso.web.webdriver.DriverAtoms.webClick; -import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertEquals; @@ -143,7 +140,8 @@ public class LoginIT { onView(withId(R.id.user_name)).check(matches(withText("User One"))); activityScenario.onActivity(activity -> { - assertEquals(loginName, Objects.requireNonNull(activity.userManager.getCurrentUser().blockingFirst()).getUserId()); + assertEquals(loginName, + Objects.requireNonNull(activity.userManager.getCurrentUser().blockingGet()).getUserId()); }); } }