Coverage Summary for Class: UserRegistrationForm (com.github.malyshevhen.dto)
Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
UserRegistrationForm |
100%
(1/1)
|
79.2%
(19/24)
|
0%
(0/18)
|
45.5%
(25/55)
|
package com.github.malyshevhen.dto;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.time.LocalDate;
import org.springframework.format.annotation.DateTimeFormat;
import org.openapitools.jackson.nullable.JsonNullable;
import java.io.Serializable;
import java.time.OffsetDateTime;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import java.util.*;
import jakarta.annotation.Generated;
/**
* Information of the user.
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2024-04-30T13:08:47.886427131+03:00[Europe/Kyiv]")
public class UserRegistrationForm implements Serializable {
private static final long serialVersionUID = 1L;
private String email;
private String firstName;
private String lastName;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private LocalDate birthDate;
private com.github.malyshevhen.domain.models.Address address;
private String phone;
public UserRegistrationForm() {
super();
}
/**
* Constructor with only required parameters
*/
public UserRegistrationForm(String email, String firstName, String lastName, LocalDate birthDate) {
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
this.birthDate = birthDate;
}
public UserRegistrationForm email(String email) {
this.email = email;
return this;
}
/**
* Users email
* @return email
*/
@NotNull @Pattern(regexp = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$")
@JsonProperty("email")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public UserRegistrationForm firstName(String firstName) {
this.firstName = firstName;
return this;
}
/**
* First name of user.
* @return firstName
*/
@NotNull @Size(min = 1, max = 256)
@JsonProperty("firstName")
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public UserRegistrationForm lastName(String lastName) {
this.lastName = lastName;
return this;
}
/**
* Last name of user.
* @return lastName
*/
@NotNull @Size(min = 1, max = 256)
@JsonProperty("lastName")
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public UserRegistrationForm birthDate(LocalDate birthDate) {
this.birthDate = birthDate;
return this;
}
/**
* Birth date of the user. Must be earlier than current date.
* @return birthDate
*/
@NotNull @Valid
@JsonProperty("birthDate")
public LocalDate getBirthDate() {
return birthDate;
}
public void setBirthDate(LocalDate birthDate) {
this.birthDate = birthDate;
}
public UserRegistrationForm address(com.github.malyshevhen.domain.models.Address address) {
this.address = address;
return this;
}
/**
* Get address
* @return address
*/
@Valid
@JsonProperty("address")
public com.github.malyshevhen.domain.models.Address getAddress() {
return address;
}
public void setAddress(com.github.malyshevhen.domain.models.Address address) {
this.address = address;
}
public UserRegistrationForm phone(String phone) {
this.phone = phone;
return this;
}
/**
* Users phone number
* @return phone
*/
@JsonProperty("phone")
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UserRegistrationForm userRegistrationForm = (UserRegistrationForm) o;
return Objects.equals(this.email, userRegistrationForm.email) &&
Objects.equals(this.firstName, userRegistrationForm.firstName) &&
Objects.equals(this.lastName, userRegistrationForm.lastName) &&
Objects.equals(this.birthDate, userRegistrationForm.birthDate) &&
Objects.equals(this.address, userRegistrationForm.address) &&
Objects.equals(this.phone, userRegistrationForm.phone);
}
@Override
public int hashCode() {
return Objects.hash(email, firstName, lastName, birthDate, address, phone);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UserRegistrationForm {\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" birthDate: ").append(toIndentedString(birthDate)).append("\n");
sb.append(" address: ").append(toIndentedString(address)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}