Search in sources :

Example 11 with JsonTestUser

use of com.dtflys.test.http.model.JsonTestUser in project forest by dromara.

the class TestGetClient method testAnnObjectGet.

@Test
public void testAnnObjectGet() throws InterruptedException {
    server.enqueue(new MockResponse().setHeader("Content-Type", "application/json").setHeader("Content-Encoding", "UTF-8").setBody(EXPECTED));
    JsonTestUser user = new JsonTestUser();
    user.setUsername("foo");
    assertThat(getClient.annObjectGet(user)).isNotNull().isEqualTo(EXPECTED);
    mockRequest(server).assertHeaderEquals("Accept", "text/plain").assertPathEquals("/hello/user").assertQueryEquals("username", "foo");
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) JsonTestUser(com.dtflys.test.http.model.JsonTestUser) Test(org.junit.Test)

Aggregations

JsonTestUser (com.dtflys.test.http.model.JsonTestUser)11 MockResponse (okhttp3.mockwebserver.MockResponse)11 Test (org.junit.Test)11 JsonTestList (com.dtflys.test.http.model.JsonTestList)5 ForestLogger (com.dtflys.forest.logging.ForestLogger)4 ArrayList (java.util.ArrayList)3 ForestRequest (com.dtflys.forest.http.ForestRequest)1