@Test public void givenNullProfileName_whenIFromSerialized_thenIExpectExactlyEmpty() { ProfileName profileName = ProfileName.fromSerialized(null); assertSame(ProfileName.EMPTY, profileName); }
public static @NonNull ProfileName fromSerialized(@Nullable String profileName) { if (profileName == null || profileName.isEmpty()) { return EMPTY; } String[] parts = profileName.split("\0"); if (parts.length == 0) { return EMPTY; } else if (parts.length == 1) { return fromParts(parts[0], ""); } else { return fromParts(parts[0], parts[1]); } }
ProfileName implements Parcelable { public static @NonNull ProfileName fromSerialized(@Nullable String profileName) { if (profileName == null || profileName.isEmpty()) { return EMPTY; } String[] parts = profileName.split("\0"); if (parts.length == 0) { return EMPTY; } else if (parts.length == 1) { return fromParts(parts[0], ""); } else { return fromParts(parts[0], parts[1]); } } }
ProfileName implements Parcelable { public static @NonNull ProfileName fromSerialized(@Nullable String profileName) { if (profileName == null || profileName.isEmpty()) { return EMPTY; } String[] parts = profileName.split("\0"); if (parts.length == 0) { return EMPTY; } else if (parts.length == 1) { return fromParts(parts[0], ""); } else { return fromParts(parts[0], parts[1]); } } private  ProfileName(@Nullable String givenName, @Nullable String familyName); private  ProfileName(Parcel in); }
ProfileName implements Parcelable { public static @NonNull ProfileName fromSerialized(@Nullable String profileName) { if (profileName == null || profileName.isEmpty()) { return EMPTY; } String[] parts = profileName.split("\0"); if (parts.length == 0) { return EMPTY; } else if (parts.length == 1) { return fromParts(parts[0], ""); } else { return fromParts(parts[0], parts[1]); } } private  ProfileName(@Nullable String givenName, @Nullable String familyName); private  ProfileName(Parcel in); @NonNull String getGivenName(); @NonNull String getFamilyName(); boolean isEmpty(); boolean isGivenNameEmpty(); @NonNull String serialize(); @Override @NonNull String toString(); static @NonNull ProfileName fromSerialized(@Nullable String profileName); static @NonNull ProfileName fromParts(@Nullable String givenName, @Nullable String familyName); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); @Override boolean equals(Object o); @Override int hashCode(); }
ProfileName implements Parcelable { public static @NonNull ProfileName fromSerialized(@Nullable String profileName) { if (profileName == null || profileName.isEmpty()) { return EMPTY; } String[] parts = profileName.split("\0"); if (parts.length == 0) { return EMPTY; } else if (parts.length == 1) { return fromParts(parts[0], ""); } else { return fromParts(parts[0], parts[1]); } } private  ProfileName(@Nullable String givenName, @Nullable String familyName); private  ProfileName(Parcel in); @NonNull String getGivenName(); @NonNull String getFamilyName(); boolean isEmpty(); boolean isGivenNameEmpty(); @NonNull String serialize(); @Override @NonNull String toString(); static @NonNull ProfileName fromSerialized(@Nullable String profileName); static @NonNull ProfileName fromParts(@Nullable String givenName, @Nullable String familyName); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); @Override boolean equals(Object o); @Override int hashCode(); static final ProfileName EMPTY; static final int MAX_PART_LENGTH; static final Creator<ProfileName> CREATOR; }