I am new to REST-Api testing. i am getting started with Rest-Assured for Rest-Api testing. i am having an issue in my first ever testcase.

The code is as follows:

public void testGetSingleUser() {
          "email", equals("[email protected]"),
          "firstName", equals("Tim"),
          "lastName", equals("Testerman"),
          "id", equals("1")).

In this code the expect(). command is not working. I need to fix this issue quickly and move on.


1 Answer 1


Updated Answer

You have to import the RestAssured class incl. method as static.

import static com.jayway.restassured.RestAssured.expect;

Or you call the method on this way:


Useful Links

  • equalsTo() is not working. equals() in working fine. The problem is that my expect() command is not working. I am using eclipse with rest-assured jar included. Commented Oct 9, 2014 at 7:20
  • @JarreeArhamShahid Can you put the exception into your question, to be more specific? Thank you.
    – Twaldigas
    Commented Oct 9, 2014 at 7:21
  • java.lang.Error: Unresolved compilation problem: The method expect() is undefined for the type RestTest Commented Oct 9, 2014 at 7:33
  • This is the failure trace. Its not working because the expect() in the code above has an error. Do i need to include any jars to make it work? Commented Oct 9, 2014 at 7:34
  • @JarreeArhamShahid Updated the answer.
    – Twaldigas
    Commented Oct 9, 2014 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.