本文整理汇总了Java中com.jayway.restassured.parsing.Parser类的典型用法代码示例。如果您正苦于以下问题:Java Parser类的具体用法?Java Parser怎么用?Java Parser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Parser类属于com.jayway.restassured.parsing包,在下文中一共展示了Parser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testIllegalOfferId
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test illegal offer id.
*/
@Test
public void testIllegalOfferId() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.param("offer_id", "asdf")
.when()
.get(OFFERPHOTO_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:19,代码来源:OfferPhotoRestControllerIT.java
示例2: testLoginValidUser
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test login with valid user.
*/
@Test
public void testLoginValidUser()
{
RestAssured
.registerParser("text/plain", Parser.TEXT);
User user = getUserWithUserTypeKunde();
userRepository.save(user);
String authString = user.getUsername() + ":" + user.getPasswordconfirm();
byte[] base64Encoded = Base64.getEncoder().encode(authString.getBytes());
String encodedString = new String(base64Encoded);
Response reponse = RestAssured
.given()
.header("Authorization", "Basic " + encodedString)
.when()
.get(LOGIN_USER_API)
.then()
.statusCode(200)
.extract().response();
Assert.assertEquals("0", reponse.asString());
}
开发者ID:andju,项目名称:findlunch,代码行数:27,代码来源:LoginUserRestControllerIT.java
示例3: testIllegalRestaurantId
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test illegal restaurant id.
*/
@Test
public void testIllegalRestaurantId() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.param("restaurant_id", "asdf")
.when()
.get(OFFER_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:19,代码来源:OfferRestControllerIT.java
示例4: testIllegalLatitude
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test illegal latitude.
*/
@Test
public void testIllegalLatitude() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.param("radius", 0)
.param("longitude", -1)
.param("latitude", "asdf")
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:21,代码来源:RestaurantRestControllerIT.java
示例5: testIllegalLongitude
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test illegal longitude.
*/
@Test
public void testIllegalLongitude() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.param("radius", 0)
.param("longitude", "asdf")
.param("latitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:21,代码来源:RestaurantRestControllerIT.java
示例6: testIllegalRadius
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test illegal radius.
*/
@Test
public void testIllegalRadius() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.param("radius", "asdf")
.param("longitude", -1)
.param("latitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:21,代码来源:RestaurantRestControllerIT.java
示例7: tesLatitudeEmpty
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test empty latitude.
*/
@Test
public void tesLatitudeEmpty() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.param("radius", 0)
.param("longitude", -1)
.param("latitude", "")
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:21,代码来源:RestaurantRestControllerIT.java
示例8: testLongitudeEmpty
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test empty longitude.
*/
@Test
public void testLongitudeEmpty() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.param("radius", 0)
.param("longitude", "")
.param("latitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:21,代码来源:RestaurantRestControllerIT.java
示例9: testRadiusEmpty
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test empty radius.
*/
@Test
public void testRadiusEmpty() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.param("radius", "")
.param("longitude", -1)
.param("latitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:21,代码来源:RestaurantRestControllerIT.java
示例10: testRequiredParameterMissing
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test required parameter missing.
*/
@Test
public void testRequiredParameterMissing() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.param("radius", 0)
.param("longitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MissingServletRequestParameterException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:20,代码来源:RestaurantRestControllerIT.java
示例11: testIllegalLatitudeAuthorizedCall
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test illegal latitude.
*/
@Test
public void testIllegalLatitudeAuthorizedCall() {
User user = getUserWithUserTypeKunde();
userRepository.save(user);
String authString = user.getUsername() + ":" + user.getPasswordconfirm();
byte[] base64Encoded = Base64.getEncoder().encode(authString.getBytes());
String encodedString = new String(base64Encoded);
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.header("Authorization", "Basic " + encodedString)
.param("radius", 0)
.param("longitude", -1)
.param("latitude", "asdf")
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:28,代码来源:RestaurantRestControllerIT.java
示例12: testIllegalLongitudeAuthorizedCall
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test illegal longitude.
*/
@Test
public void testIllegalLongitudeAuthorizedCall() {
User user = getUserWithUserTypeKunde();
userRepository.save(user);
String authString = user.getUsername() + ":" + user.getPasswordconfirm();
byte[] base64Encoded = Base64.getEncoder().encode(authString.getBytes());
String encodedString = new String(base64Encoded);
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.header("Authorization", "Basic " + encodedString)
.param("radius", 0)
.param("longitude", "asdf")
.param("latitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:28,代码来源:RestaurantRestControllerIT.java
示例13: testIllegalRadiusAuthorizedCall
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test illegal radius.
*/
@Test
public void testIllegalRadiusAuthorizedCall() {
User user = getUserWithUserTypeKunde();
userRepository.save(user);
String authString = user.getUsername() + ":" + user.getPasswordconfirm();
byte[] base64Encoded = Base64.getEncoder().encode(authString.getBytes());
String encodedString = new String(base64Encoded);
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.header("Authorization", "Basic " + encodedString)
.param("radius", "asdf")
.param("longitude", -1)
.param("latitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:28,代码来源:RestaurantRestControllerIT.java
示例14: testLatitudeEmptyAuthorizedCall
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test empty latitude.
*/
@Test
public void testLatitudeEmptyAuthorizedCall() {
User user = getUserWithUserTypeKunde();
userRepository.save(user);
String authString = user.getUsername() + ":" + user.getPasswordconfirm();
byte[] base64Encoded = Base64.getEncoder().encode(authString.getBytes());
String encodedString = new String(base64Encoded);
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.header("Authorization", "Basic " + encodedString)
.param("radius", 0)
.param("longitude", -1)
.param("latitude", "")
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:28,代码来源:RestaurantRestControllerIT.java
示例15: testLongitudeEmptyAuthorizedCall
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test empty longitude.
*/
@Test
public void testLongitudeEmptyAuthorizedCall() {
User user = getUserWithUserTypeKunde();
userRepository.save(user);
String authString = user.getUsername() + ":" + user.getPasswordconfirm();
byte[] base64Encoded = Base64.getEncoder().encode(authString.getBytes());
String encodedString = new String(base64Encoded);
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.header("Authorization", "Basic " + encodedString)
.param("radius", 0)
.param("longitude", "")
.param("latitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:28,代码来源:RestaurantRestControllerIT.java
示例16: testRadiusEmptyAuthorizedCall
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test empty radius.
*/
@Test
public void testRadiusEmptyAuthorizedCall() {
User user = getUserWithUserTypeKunde();
userRepository.save(user);
String authString = user.getUsername() + ":" + user.getPasswordconfirm();
byte[] base64Encoded = Base64.getEncoder().encode(authString.getBytes());
String encodedString = new String(base64Encoded);
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.header("Authorization", "Basic " + encodedString)
.param("radius", "")
.param("longitude", -1)
.param("latitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MethodArgumentTypeMismatchException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:28,代码来源:RestaurantRestControllerIT.java
示例17: testRequiredParameterMissingAuthorizedCall
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test required parameter missing.
*/
@Test
public void testRequiredParameterMissingAuthorizedCall() {
User user = getUserWithUserTypeKunde();
userRepository.save(user);
String authString = user.getUsername() + ":" + user.getPasswordconfirm();
byte[] base64Encoded = Base64.getEncoder().encode(authString.getBytes());
String encodedString = new String(base64Encoded);
RestAssured
.registerParser("text/plain", Parser.TEXT);
RestAssured
.given()
.header("Authorization", "Basic " + encodedString)
.param("radius", 0)
.param("longitude", -1)
.when()
.get(RESTAURANT_API)
.then()
.statusCode(200)
.body(Matchers.containsString(MissingServletRequestParameterException.class.toString()));
}
开发者ID:andju,项目名称:findlunch,代码行数:27,代码来源:RestaurantRestControllerIT.java
示例18: testUsernameAlreadyExists
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test username alrady exists.
*/
@Test
public void testUsernameAlreadyExists() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
User user = getUser();
userRepository.save(user);
// To test a real life scenaria, the user type is set to null, since the app does not send an user type within the json.
// It was only set to pre-save the user to the database (data integrity)
user.setUserType(null);
Response response = RestAssured
.given()
.contentType("application/json")
.body(user)
.when()
.post(REGISTER_USER_API)
.then()
.statusCode(409)
.extract().response();
Assert.assertEquals("3", response.asString());
}
开发者ID:andju,项目名称:findlunch,代码行数:28,代码来源:RegisterUserRestControllerIT.java
示例19: testUsernameNoValidEMail
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test username no valid email.
*/
@Test
public void testUsernameNoValidEMail() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
User user = getUserWithInvalidEmailAsUsername();
Response response = RestAssured
.given()
.contentType("application/json")
.body(user)
.when()
.post(REGISTER_USER_API)
.then()
.statusCode(409)
.extract().response();
Assert.assertEquals("1", response.asString());
}
开发者ID:andju,项目名称:findlunch,代码行数:25,代码来源:RegisterUserRestControllerIT.java
示例20: testUserWithEmptyPasswords
import com.jayway.restassured.parsing.Parser; //导入依赖的package包/类
/**
* Test user with empty passwords.
*/
@Test
public void testUserWithEmptyPasswords() {
RestAssured
.registerParser("text/plain", Parser.TEXT);
User user = getUserWithEmptyPassword();
Response response = RestAssured
.given()
.contentType("application/json")
.body(user)
.when()
.post(REGISTER_USER_API)
.then()
.statusCode(409)
.extract().response();
Assert.assertEquals("2", response.asString());
}
开发者ID:andju,项目名称:findlunch,代码行数:25,代码来源:RegisterUserRestControllerIT.java
注:本文中的com.jayway.restassured.parsing.Parser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论