22
33import com .auth0 .client .MockServer ;
44import com .auth0 .json .mgmt .logstreams .LogStream ;
5+ import com .auth0 .json .mgmt .logstreams .LogStreamFilter ;
56import com .auth0 .net .Request ;
67import com .auth0 .net .client .HttpMethod ;
78import okhttp3 .mockwebserver .RecordedRequest ;
89import org .junit .Test ;
910
11+ import java .util .Collections ;
1012import java .util .HashMap ;
1113import java .util .List ;
1214import java .util .Map ;
@@ -39,6 +41,7 @@ public void shouldListLogStreams() throws Exception {
3941 assertThat (response , everyItem (hasProperty ("type" , is (notNullValue ()))));
4042 assertThat (response , everyItem (hasProperty ("status" , is (notNullValue ()))));
4143 assertThat (response , everyItem (hasProperty ("sink" , is (notNullValue ()))));
44+ assertThat (response , everyItem (hasProperty ("filters" , is (notNullValue ()))));
4245 }
4346
4447 @ Test
@@ -72,11 +75,14 @@ public void shouldGetLogStream() throws Exception {
7275 assertThat (response , hasProperty ("type" , is (notNullValue ())));
7376 assertThat (response , hasProperty ("status" , is (notNullValue ())));
7477 assertThat (response , hasProperty ("sink" , is (notNullValue ())));
78+ assertThat (response , hasProperty ("filters" , is (notNullValue ())));
7579 }
7680
7781 @ Test
7882 public void shouldCreateLogStream () throws Exception {
7983 LogStream logStream = getLogStream ("log stream" , "http" );
84+ LogStreamFilter filter = new LogStreamFilter ("category" , "auth.ancillary.success" );
85+ logStream .setFilters (Collections .singletonList (filter ));
8086
8187 Request <LogStream > request = api .logStreams ().create (logStream );
8288 assertThat (request , is (notNullValue ()));
@@ -90,17 +96,20 @@ public void shouldCreateLogStream() throws Exception {
9096 assertThat (recordedRequest , hasHeader ("Authorization" , "Bearer apiToken" ));
9197
9298 Map <String , Object > body = bodyFromRequest (recordedRequest );
93- assertThat (body .size (), is (3 ));
99+ assertThat (body .size (), is (4 ));
94100 assertThat (body , hasEntry ("name" , "log stream" ));
95101 assertThat (body , hasEntry ("type" , "http" ));
96102 assertThat (body , hasEntry ("sink" , logStream .getSink ()));
103+ assertThat (body , hasKey ("filters" ));
104+ assertThat (body .get ("filters" ), is (notNullValue ()));
97105
98106 assertThat (response , is (notNullValue ()));
99107 assertThat (response , hasProperty ("id" , is (notNullValue ())));
100108 assertThat (response , hasProperty ("name" , is (notNullValue ())));
101109 assertThat (response , hasProperty ("type" , is (notNullValue ())));
102110 assertThat (response , hasProperty ("status" , is (notNullValue ())));
103111 assertThat (response , hasProperty ("sink" , is (notNullValue ())));
112+ assertThat (response , hasProperty ("filters" , is (notNullValue ())));
104113
105114 }
106115
0 commit comments