本文整理匯總了Java中com.eclipsesource.restfuse.annotation.HttpTest類的典型用法代碼示例。如果您正苦於以下問題:Java HttpTest類的具體用法?Java HttpTest怎麽用?Java HttpTest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HttpTest類屬於com.eclipsesource.restfuse.annotation包,在下文中一共展示了HttpTest類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newGame
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* Test for /games
* Method: POST
*/
@HttpTest( method = Method.POST,
path = "",
content = "{\n" +
" \"name\": \"Just for test\",\n" +
" \"description\": \"Testing game\",\n" +
" \"type\": \"offline\",\n" +
" \"board\": \"10x10\",\n" +
" \"state\": \"open\"\n" +
"}",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void newGame(){
assertCreated( response );
}
示例2: newUser
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* /users
* Method: POST
*/
@HttpTest( method = Method.POST,
path = "",
content = "{\n" +
" \"uuid\"\t\t: null,\n" +
" \"login\"\t\t: \"testLogin\",\n" +
" \"firstName\"\t: \"testFirstName\",\n" +
" \"lastName\"\t: \"testLastName\",\n" +
" \"email\"\t\t: \"[email protected]\",\n" +
" \"password\"\t: \"password\",\n" +
" \"enabled\"\t: true,\n" +
" \"created\"\t: 1369311377195,\n" +
" \"modified\"\t: 1369311377195,\n" +
" \"lastLogin\"\t: 1369311377195\n" +
"}",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void newUser(){
assertCreated( response );
}
示例3: modUser
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* /users/{uuid}
* Method: PUT
*/
@HttpTest( method = Method.PUT,
path = "/2",
content = "{\n" +
" \"uuid\"\t\t: null,\n" +
" \"login\"\t\t: \"modified\",\n" +
" \"firstName\"\t: \"testFirstName\",\n" +
" \"lastName\"\t: \"testLastName\",\n" +
" \"email\"\t\t: \"[email protected]\",\n" +
" \"password\"\t: \"password\",\n" +
" \"enabled\"\t: true\n" +
"}",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void modUser(){
assertOk( response );
}
示例4: testInvalidLogin
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
@HttpTest(method = Method.POST, path = "/user/barney/authenticate", type = MediaType.APPLICATION_JSON,
content = "{\"userName\":\"barney\",\"password\":\"barney\"}")
public void testInvalidLogin() {
assertBadRequest(response);
String messg = response.getBody();
Assert.assertEquals("Invalid username: barney", messg);
}
示例5: testuserGroupsListsUsers
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
@HttpTest(method = Method.GET, path = "/1")
public void testuserGroupsListsUsers() {
String message = response.getBody();
//assertTrue(message, message.contains("[{\"userNames\""));
//[{"userNames":["bbbb","aaaa","SSNAdmin"]}]
//assertTrue(message, message.matches("\\[\\{\"userNames\":\\[(\"\\w+\",?)*\\]\\}\\]"));
//Sample output is: [{"userNames":["SSNAdmin"]},{"userNames":["testuser"]}]
assertTrue(message.contains("SSNAdmin"));
}
示例6: checkApiInfoResponse
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
@HttpTest(method = Method.GET, path = "/get-api-info")
public void checkApiInfoResponse() {
assertOk(response);
Gson gson = new Gson();
ApiInfo apiInfo = gson.fromJson(response.getBody(), ApiInfo.class);
Assert.assertEquals(apiInfo, new ApiInfo());
}
示例7: checkHelloWorldResponse
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
@HttpTest(method = Method.GET, path = "/api/v1/hello-world")
public void checkHelloWorldResponse() {
assertOk(response);
Gson gson = new Gson();
HelloWorld helloWord = gson.fromJson(response.getBody(), HelloWorld.class);
Assert.assertEquals(helloWord, new HelloWorld());
}
示例8: getGames
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* Test for /games
* Method: GET
*/
@HttpTest( method = Method.GET,
path = "",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void getGames(){
assertOk( response );
}
示例9: getGamesFiltered
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* Test for /games?field={field}&value={value}
* Method: GET
*/
@HttpTest( method = Method.GET,
path = "?field=state&value=open",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void getGamesFiltered(){
assertOk( response );
}
示例10: getGame
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* Test for /games/{gauid}
* Method: GET
*/
@HttpTest( method = Method.GET,
path = "/1",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void getGame(){
assertOk( response );
}
示例11: modGame
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* Test for /games/{gauid}
* Method: PUT
*/
@HttpTest( method = Method.PUT,
path = "/1",
content = "{\n" +
" \"name\": \"Changed name\",\n" +
" \"description\": \"Testing game\"" +
"}",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void modGame(){
assertOk( response );
}
示例12: joinGame
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* Test for /games/{gauid}?action=join
* Method: PUT
*/
@HttpTest( method = Method.PUT,
path = "/1?action=join",
content = "{}",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "user", password = "user" ) }
)
public void joinGame(){
assertOk( response );
}
示例13: closeGame
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* Test for /games/{gauid}?action=close
* Method: PUT
*/
@HttpTest( method = Method.PUT,
path = "/1?action=close",
content = "{}",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void closeGame(){
assertOk( response );
}
示例14: getGameSteps
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* Test for /games/{gauid}/steps
* Method: GET
*/
@HttpTest( method = Method.GET,
path = "/1/steps",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void getGameSteps(){
assertOk( response );
}
示例15: newStepInGame
import com.eclipsesource.restfuse.annotation.HttpTest; //導入依賴的package包/類
/**
* Test for /games/{gauid}/steps
* Method: POST
*/
@HttpTest( method = Method.POST,
path = "/1/steps",
content = "{\n" +
" \"step\" : \"a1-b3\"\n" +
"}",
authentications = {
@Authentication( type = AuthenticationType.BASIC, user = "admin", password = "admin" ) }
)
public void newStepInGame(){
assertBadRequest(response);
}