如果在我的登录后推出了一个新的活动,那么我知道一切都正常.我试图实现这个,但我现在得到了
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.test.espresso.intent.Intents.internalIntended(org.hamcrest.Matcher, android.support.test.espresso.intent.VerificationMode, java.util.List)' on a null object reference
Run Code Online (Sandbox Code Playgroud)
这是我的Test类:
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
@RunWith(AndroidJUnit4.class)
public class LoginActivityTest {
@Rule
public ActivityTestRule<LoginActivity> mLoginActivityActivityTestRule =
new ActivityTestRule<>(LoginActivity.class);
@Test
public void clickLoginButton_ShowsSnackBarRightCredentials() throws Exception {
onView(withId(R.id.login_email)).perform(typeText("a@aa.aa"));
onView(withId(R.id.login_password)).perform(typeText("11111111"));
onView(withId(R.id.email_sign_in_button)).perform(click());
intended(hasComponent(MainActivity.class.getName()));
}
}
Run Code Online (Sandbox Code Playgroud)
我在之前的问题中发现这行代码应该对我有所帮助,但是这一行产生了NullPointer.
意图(hasComponent(MainActivity.class enter code here.getName()));
我怎样才能解决这个问题?我究竟做错了什么?
这是完整的堆栈跟踪:
java.lang.NullPointerException: Attempt …Run Code Online (Sandbox Code Playgroud) 假设我已经有了一个反应式流,现在我想向这个现有流添加一个对象。我怎样才能做到这一点?
这是我发现的方法,这是要走的路吗?
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;
/**
* Created by ton on 10/11/16.
*/
public class Example {
private List<FluxSink<String>> handlers = new ArrayList<>();
public Flux<String> getMessagesAsStream() {
Flux<String> result = Flux.create(sink -> {
handlers.add(sink);
sink.setCancellation(() -> handlers.remove(sink));
});
return result;
}
public void handleMessage(String message) {
handlers.forEach(han -> han.next(message));
}
public static void main(String[] args) {
Example example = new Example();
example.getMessagesAsStream().subscribe(req -> System.out.println("req = " + req));
example.getMessagesAsStream().subscribe(msg -> System.out.println(msg.toUpperCase())); …Run Code Online (Sandbox Code Playgroud) 有没有办法使用注册表中的私有映像以及自定义 GitHub Docker 容器操作的身份验证?想要将 running.image 指向私有 docker 映像。理想情况下,上传到 GitHub Packages 注册表的一个。
# action.yml
name: 'Hello World'
description: 'Greet someone'
inputs:
who_to_greet: # id of input
description: 'Who to greet'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.who_to_greet }}
Run Code Online (Sandbox Code Playgroud)
https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action
如何在Go中从请求获取所有可用的HTTP标头作为数组?我只看到以下两种方法:
但是在这种情况下,我需要知道标题的名称,并且不能返回所有现有的标题。我想将http标头从一个请求复制到另一个请求。