public UserIdentity create(GsonUser gsonUser, @Nullable GsonEmails gsonEmails) {
    UserIdentity.Builder builder = UserIdentity.builder()
      .setProviderId(gsonUser.getUuid())
      .setProviderLogin(gsonUser.getUsername())
      .setName(generateName(gsonUser));
    if (gsonEmails != null) {
      builder.setEmail(gsonEmails.extractPrimaryEmail());
    }
    return builder.build();
  }
@Test
  public void empty_name_is_replaced_by_provider_login() {
    GsonUser gson = new GsonUser("john", "", "ABCD");

    UserIdentity identity = underTest.create(gson, null);
    assertThat(identity.getName()).isEqualTo("john");
  }