fix tests

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-06-24 13:36:40 +02:00
parent 69fc02b0cb
commit ffe41182d1
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 6 additions and 12 deletions

View file

@ -1,9 +1,9 @@
package com.nextcloud.talk.activities package com.nextcloud.talk.activities
import androidx.test.espresso.intent.rule.IntentsTestRule 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 com.nextcloud.talk.users.UserManager
import io.reactivex.Observer import io.reactivex.SingleObserver
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
import org.junit.Assert.fail import org.junit.Assert.fail
import org.junit.Rule import org.junit.Rule
@ -35,12 +35,12 @@ class MainActivityTest {
certificateAlias = null, certificateAlias = null,
externalSignalingServer = null externalSignalingServer = null
) )
).subscribe(object : Observer<UserNgEntity?> { ).subscribe(object : SingleObserver<User?> {
override fun onSubscribe(d: Disposable) { override fun onSubscribe(d: Disposable) {
// unused atm // unused atm
} }
override fun onNext(user: UserNgEntity) { override fun onSuccess(user: User) {
sut.runOnUiThread { sut.resetConversationsList() } sut.runOnUiThread { sut.resetConversationsList() }
println("User: " + user.id + " / " + user.userId + " / " + user.baseUrl) println("User: " + user.id + " / " + user.userId + " / " + user.baseUrl)
@ -49,10 +49,6 @@ class MainActivityTest {
override fun onError(e: Throwable) { override fun onError(e: Throwable) {
fail("No user created") fail("No user created")
} }
override fun onComplete() {
// unused atm
}
}) })
} }
} }

View file

@ -29,8 +29,6 @@ import android.os.Bundle;
import com.nextcloud.talk.R; import com.nextcloud.talk.R;
import com.nextcloud.talk.activities.MainActivity; import com.nextcloud.talk.activities.MainActivity;
import junit.framework.AssertionFailedError;
import org.junit.Test; import org.junit.Test;
import java.util.Objects; 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.sugar.Web.onWebView;
import static androidx.test.espresso.web.webdriver.DriverAtoms.findElement; import static androidx.test.espresso.web.webdriver.DriverAtoms.findElement;
import static androidx.test.espresso.web.webdriver.DriverAtoms.webClick; import static androidx.test.espresso.web.webdriver.DriverAtoms.webClick;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -143,7 +140,8 @@ public class LoginIT {
onView(withId(R.id.user_name)).check(matches(withText("User One"))); onView(withId(R.id.user_name)).check(matches(withText("User One")));
activityScenario.onActivity(activity -> { activityScenario.onActivity(activity -> {
assertEquals(loginName, Objects.requireNonNull(activity.userManager.getCurrentUser().blockingFirst()).getUserId()); assertEquals(loginName,
Objects.requireNonNull(activity.userManager.getCurrentUser().blockingGet()).getUserId());
}); });
} }
} }