Search in sources :

Example 6 with LogStream

use of com.auth0.json.mgmt.logstreams.LogStream in project auth0-java by auth0.

the class LogStreamsEntityTest method shouldListLogStreams.

@Test
public void shouldListLogStreams() throws Exception {
    Request<List<LogStream>> request = api.logStreams().list();
    assertThat(request, is(notNullValue()));
    server.jsonResponse(MockServer.MGMT_LOG_STREAMS_LIST, 200);
    List<LogStream> response = request.execute();
    RecordedRequest recordedRequest = server.takeRequest();
    assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/log-streams"));
    assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
    assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
    assertThat(response, is(notNullValue()));
    assertThat(response, hasSize(2));
    assertThat(response, everyItem(hasProperty("id", is(notNullValue()))));
    assertThat(response, everyItem(hasProperty("name", is(notNullValue()))));
    assertThat(response, everyItem(hasProperty("type", is(notNullValue()))));
    assertThat(response, everyItem(hasProperty("status", is(notNullValue()))));
    assertThat(response, everyItem(hasProperty("sink", is(notNullValue()))));
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) List(java.util.List) LogStream(com.auth0.json.mgmt.logstreams.LogStream) Test(org.junit.Test)

Aggregations

LogStream (com.auth0.json.mgmt.logstreams.LogStream)6 Test (org.junit.Test)5 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)4 HashMap (java.util.HashMap)1 List (java.util.List)1