java - The type of hasStatusCode(int) is erroneous - Netbeans 8.0.2 -
i'm playing around rest driver api test restful service.
from github example, have:
response response = get( "http://www.example.com" ); assertthat(response, hasstatuscode(200)); // compilation error here! assertthat(response.asjson(), hasjsonpath("$.name", equalto("jeff")));
if place code inside method in test class strange compilation error netbeans.
the error is: the type of hasstatuscode(int) erroneous
(see comment (in code) above error shown.
i couldn't info error , informations found question, here.
i've restarted netbeans , compilation error never goes away. hope either netbeans bug or i've imported wrong class(es).
here's class code:
import com.github.restdriver.serverdriver.matchers; import static com.github.restdriver.serverdriver.restserverdriver.get; import static com.github.restdriver.serverdriver.restserverdriver.header; import com.github.restdriver.serverdriver.http.response.response; import org.junit.after; import org.junit.afterclass; import static org.junit.assert.assertthat; import static org.junit.assert.asserttrue; import org.junit.before; import org.junit.beforeclass; import org.junit.test; public class newemptyjunittest { public newemptyjunittest() { } @beforeclass public static void setupclass() { } @afterclass public static void teardownclass() { } @before public void setup() { } @after public void teardown() { } @test public void getjsonresponse() { response response = get("google.com" + "/things/5", header("accept", "application/json")); // hamcrest matcher http status code assertthat(response, matchers.hasstatuscode(200)); // compilation error here -> "the type of hasstatuscode(int) erroneous" } }
any on how solve error?
i found problem.
as i'm using maven build project, pasted (rest driver) maven dependency code , assumed right.
well, not, reason using 1.1 version of harmcrest-core
dependency instead of version 1.3
i've added version 1.3 of harmcrest-core
dependency, removed version 1.1 , compiles fine.
Comments
Post a Comment