2016-12-06 12 views
0

EclipseでJunitを使用して初めてのAcceptance Testのケースを実行しています。下記のコードは私がまだ作業中だから完全ではありません。私はこのエラーに遭遇しましたが、私はそれを解決する方法がわかりません。given()メソッドはPendingTransactionsTest型では未定義です

エラーの種類:

package bns.so.unitTest; 
import java.util.HashMap; 
import java.util.Map; 
import org.junit.Test; 
import com.jayway.restassured.RestAssured; 
import bns.so.models.PendingTransactionsRequestModel; 
public class PendingTransactionsTest extends BaseUnitTest{ 

    Map<String, Object> mapBody = new HashMap<String, Object>(); 
    private static PendingTransactionsRequestModel transModel = new PendingTransactionsRequestModel(); 
    private static final String countryID = "ZZ"; 
    private static final String accountID = "2"; 
    private static final String customerID = "3"; 
    private static final String startDate = "2016-10-31 00:00:00"; 
    private static final String endDate = "2016-12-07 00:00:00"; 
    private static final String startAmount = "123123"; 
    private static final String endAmount = "200000"; 
    private static final String sortOption = "asc"; 
    private static final String sortOrder = "desc"; 
    private static final String numRecords = "1"; 
    private static final String lastRecordKey = "0"; 
    private static final String transType = "FundsTransfer"; 


    @Test 
    public void accountIdTest(){ 
     mapBody = new HashMap<String, Object>(); 
     mapBody.put("accountID", PendingTransactionsTest.accountID); 
     RestAssured. 
     given(). 
     header("accountID", 2). 
     contentType("application/json"). 
     body(mapBody). 

    when(). 
     post("path"). 

    then(). 
     statusCode(200). 
     //body("status.status", equals (0)).- doesn't work how do I reword this? 
     body("status.reason", null); 

}} 
+0

あなたは何が起こるか指定されたメソッドの前からRestAssuredを削除する場合は? – Joey

+0

私はそれを試みたが、エラーはまだそこにある。 –

答えて

-1

使用このインポートまた

static com.jayway.restassured.RestAssured.given; 

、​​でRestAssured.given()を置き換える:指定された方法は、()

はコードタイプのために定義されていません。

1

あなたはimport文の下に使用することができます。

import static com.jayway.restassured.RestAssured.*; 
関連する問題