@@ -54,7 +54,28 @@ public void shouldCreateWithDomainAndToken() {
5454 }
5555
5656 @ Test
57- public void shouldCreateWithHttpClient () {
57+ public void shouldCreateWithHttpClientWithApiToken () {
58+ Auth0HttpClient httpClient = new Auth0HttpClient () {
59+ @ Override
60+ public Auth0HttpResponse sendRequest (Auth0HttpRequest request ) {
61+ return null ;
62+ }
63+
64+ @ Override
65+ public CompletableFuture <Auth0HttpResponse > sendRequestAsync (Auth0HttpRequest request ) {
66+ return null ;
67+ }
68+ };
69+
70+ ManagementAPI api = ManagementAPI .newBuilder (DOMAIN , API_TOKEN )
71+ .withHttpClient (httpClient ).build ();
72+
73+ assertThat (api , is (notNullValue ()));
74+ assertThat (api .getHttpClient (), is (httpClient ));
75+ }
76+
77+ @ Test
78+ public void shouldCreateWithHttpClientWithTokenProvider () {
5879 Auth0HttpClient httpClient = new Auth0HttpClient () {
5980 @ Override
6081 public Auth0HttpResponse sendRequest (Auth0HttpRequest request ) {
@@ -106,6 +127,13 @@ public void shouldThrowWhenApiTokenIsNull() {
106127 "'api token' cannot be null!" );
107128 }
108129
130+ @ Test
131+ public void shouldThrowWhenTokenProviderIsNull () {
132+ verifyThrows (IllegalArgumentException .class ,
133+ () -> ManagementAPI .newBuilder (DOMAIN , (TokenProvider ) null ).build (),
134+ "'token provider' cannot be null!" );
135+ }
136+
109137 @ Test
110138 public void shouldThrowOnUpdateWhenApiTokenIsNull () {
111139 ManagementAPI api = ManagementAPI .newBuilder (DOMAIN , API_TOKEN ).build ();
0 commit comments