@@ -400,6 +400,13 @@ public void shouldThrowOnUsernameSignUpWithNullConnection() {
400400 "'connection' cannot be null!" );
401401 }
402402
403+ @ Test
404+ public void shouldThrowOnUsernameAndPhoneNumberSignUpWithNullPhoneNumber () {
405+ verifyThrows (IllegalArgumentException .class ,
406+ () -> api .signUp ("me@auth0.com" , "me" , new char []{'p' ,'4' ,'5' ,'5' ,'w' ,'0' ,'r' ,'d' }, "my-connection" , null ),
407+ "'phone number' cannot be null!" );
408+ }
409+
403410 @ Test
404411 public void shouldHaveNotStrongPasswordWithDetailedDescription () throws Exception {
405412 ObjectMapper mapper = new ObjectMapper ();
@@ -424,6 +431,34 @@ public void shouldHaveNotStrongPasswordWithShortDetailedDescription() throws Exc
424431 assertThat (ex .getDescription (), is (expectedDescription ));
425432 }
426433
434+ @ Test
435+ public void shouldCreateSignUpRequestWithUsernameAndPhoneNumber () throws Exception {
436+ SignUpRequest request = api .signUp ("me@auth0.com" , "me" , new char []{'p' ,'4' ,'5' ,'5' ,'w' ,'0' ,'r' ,'d' }, "db-connection" , "1234567890" );
437+ assertThat (request , is (notNullValue ()));
438+
439+ server .jsonResponse (AUTH_SIGN_UP_USERNAME , 200 );
440+ CreatedUser response = request .execute ().getBody ();
441+ RecordedRequest recordedRequest = server .takeRequest ();
442+
443+ assertThat (recordedRequest , hasMethodAndPath (HttpMethod .POST , "/dbconnections/signup" ));
444+ assertThat (recordedRequest , hasHeader ("Content-Type" , "application/json" ));
445+
446+ Map <String , Object > body = bodyFromRequest (recordedRequest );
447+ assertThat (body , hasEntry ("email" , "me@auth0.com" ));
448+ assertThat (body , hasEntry ("username" , "me" ));
449+ assertThat (body , hasEntry ("password" , "p455w0rd" ));
450+ assertThat (body , hasEntry ("connection" , "db-connection" ));
451+ assertThat (body , hasEntry ("client_id" , CLIENT_ID ));
452+ assertThat (body , hasEntry ("phone_number" , "1234567890" ));
453+
454+ assertThat (response , is (notNullValue ()));
455+ assertThat (response .getUserId (), is ("58457fe6b27" ));
456+ assertThat (response .getEmail (), is ("me@auth0.com" ));
457+ assertThat (response .isEmailVerified (), is (false ));
458+ assertThat (response .getUsername (), is ("me" ));
459+ assertThat (response .getPhoneNumber (), is ("1234567890" ));
460+ }
461+
427462 @ Test
428463 public void shouldCreateSignUpRequestWithUsername () throws Exception {
429464 @ SuppressWarnings ("deprecation" )
0 commit comments