我尝试使用MockWebServer进行测试。
我想使用模拟响应进行UI测试,因此我可以测试有效\无效的UI更改,例如登录,或在登录API中显示错误。
但是,每次运行代码时,我都会遇到以下异常:
public async Task<User> CreateUser(GraphServiceClient graphClient)
{
// This snippet gets the tenant domain from the Organization object to construct the user's email address.
var organization = await graphClient.Organization.Request().GetAsync();
var domain = organization.CurrentPage[0].VerifiedDomains.ElementAt(0).Name;
// Add the user.
var userEmail = "TestUser@" + domain;
var mailNickname = userEmail.Split(new char[] { '@' }).FirstOrDefault();
return await graphClient.Users.Request().AddAsync(new User
{
AccountEnabled = true,
DisplayName = "Test User",
MailNickname = mailNickname,
PasswordProfile = new PasswordProfile
{
Password = "super_strong_password"
},
UserPrincipalName = userEmail
});
}
代码:
java.lang.IllegalStateException: start() already called
我做错了什么? .start()只调用一次,我甚至.shutdown()只调用 案例......我不明白它怎么能不止一次打电话。
提前致谢。