本文整理汇总了Java中au.com.dius.pact.provider.junit.State类的典型用法代码示例。如果您正苦于以下问题:Java State类的具体用法?Java State怎么用?Java State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
State类属于au.com.dius.pact.provider.junit包,在下文中一共展示了State类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: noSetUp
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State({"a forgotten password does not exists",
"a user does not exist",
"a user exists",
"no user exits with the given name",
"a user exits with the given name",
"a valid (non-expired) forgotten password entry does not exist",
"default",
"a user exist",
"a user exists with a given username password",
"a user not exists with a given username password",
"a user not exists with a given username password",
"no user exits with the given external id",
"a user exits with the given external id"
})
public void noSetUp() {
}
示例2: customerLoaderIsAvailable
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("Remote customer loader is available")
public void customerLoaderIsAvailable() {
CustomerAddressImpl address = Fixture.from(CustomerAddressImpl.class).gimme("valid");
when(customerService.createAddress(
anyString(),
anyString(),
anyString(),
anyString(),
anyString(),
anyString()
)).thenReturn(address);
}
示例3: customerLoaderIsNotAvailable
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("Remote customer loader is not available")
public void customerLoaderIsNotAvailable() {
when(customerService.createAddress(
anyString(),
anyString(),
anyString(),
anyString(),
anyString(),
anyString()
)).thenThrow(exception);
}
示例4: aUserExistsWithAForgottenPasswordRequest
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("a valid forgotten password entry and a related user exists")
public void aUserExistsWithAForgottenPasswordRequest() throws Exception {
String code = "avalidforgottenpasswordtoken";
String userExternalId = RandomIdGenerator.randomUuid();
createUserWithinAService(userExternalId, randomAlphabetic(20), "password");
List<Map<String, Object>> userByExternalId = dbHelper.findUserByExternalId(userExternalId);
dbHelper.add(ForgottenPassword.forgottenPassword(code, userExternalId), (Integer) userByExternalId.get(0).get("id"));
}
示例5: aForgottenPasswordEntryExist
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("a forgotten password entry exist")
public void aForgottenPasswordEntryExist() throws Exception {
String code = "existing-code";
String existingUserExternalId = "7d19aff33f8948deb97ed16b2912dcd3";
List<Map<String, Object>> userByName = dbHelper.findUserByExternalId(existingUserExternalId);
dbHelper.add(ForgottenPassword.forgottenPassword(code, existingUserExternalId), (Integer) userByName.get(0).get("id"));
}
示例6: aUserAndUserAdminExistBeforeADelete
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("a user and user admin exists in service with the given ids before a delete operation")
public void aUserAndUserAdminExistBeforeADelete() throws Exception {
String existingUserExternalId = "pact-delete-user-id";
String existingUserRemoverExternalId = "pact-delete-remover-id";
String existingServiceExternalId = "pact-delete-service-id";
Service service = ServiceDbFixture.serviceDbFixture(dbHelper).withExternalId(existingServiceExternalId).insertService();
Role role = RoleDbFixture.roleDbFixture(dbHelper).insertAdmin();
UserDbFixture.userDbFixture(dbHelper).withExternalId(existingUserExternalId).withServiceRole(service, role.getId()).insertUser();
UserDbFixture.userDbFixture(dbHelper).withExternalId(existingUserRemoverExternalId).withServiceRole(service, role.getId()).insertUser();
}
示例7: aUserExistButRemoverBeforeADelete
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("a user exists but not the remover before a delete operation")
public void aUserExistButRemoverBeforeADelete() throws Exception {
String existingUserExternalId = "pact-user-no-remover-test";
String existingServiceExternalId = "pact-service-no-remover-test";
Service service = ServiceDbFixture.serviceDbFixture(dbHelper).withExternalId(existingServiceExternalId).insertService();
Role role = RoleDbFixture.roleDbFixture(dbHelper).insertAdmin();
UserDbFixture.userDbFixture(dbHelper).withExternalId(existingUserExternalId).withServiceRole(service, role.getId()).insertUser();
}
示例8: tonyStarkBecameANewMember
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("Tony Stark became a new member")
public void tonyStarkBecameANewMember() {
String email = "[email protected]";
creditScoreServiceRule.setCreditResponse(email,
giveResponse("{\"creditScore\":850}", APPLICATION_JSON));
Map<String, Object> specialMembershipDto = singletonMap("email", email);
Response response = resourcesClient.postSpecialMembership(specialMembershipDto);
response.close();
assertThat(response.getStatus(), equalTo(200));
}
示例9: stateChange
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("a serval exists")
public void stateChange() {}
示例10: foundSpecifiedCustomer
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("Customer Sean is registered")
public void foundSpecifiedCustomer() {
when(customerService.getCustomerByUsername(customer.getUsername())).thenReturn(customer);
when(customerService.validateSession(customerSessionInfo.getId())).thenReturn(customerSessionInfo);
}
示例11: noSuchCustomerFound
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("No customer Mike found")
public void noSuchCustomerFound() {
when(customerService.getCustomerByUsername("mike")).thenReturn(null);
when(customerService.validateSession("session-mike-123")).thenReturn(null);
}
示例12: acceptAuthenticatedUser
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("User Sean is authorized")
public void acceptAuthenticatedUser() {
when(authenticationService.validate("sean-token")).thenReturn("Sean");
}
示例13: rejectUnknownUser
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("User Jack is unauthorized")
public void rejectUnknownUser() {
when(authenticationService.validate("unknown-token"))
.thenThrow(new UnauthorizedAccessException("No user matches such a token unknown-token"));
}
示例14: toDefaultState
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("default")
public void toDefaultState() {
System.out.println("Now service in default state");
}
示例15: aUserExistsWithMaxLoginAttempts
import au.com.dius.pact.provider.junit.State; //导入依赖的package包/类
@State("a user exists with max login attempts")
public void aUserExistsWithMaxLoginAttempts() throws Exception {
String username = "user-login-attempts-max";
createUserWithinAService(RandomIdGenerator.randomUuid(), username, "password");
dbHelper.updateLoginCount(username, 10);
}