Coverage Summary for Class: UserMapperImpl (com.github.malyshevhen.domain.mapper)
Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
UserMapperImpl |
100%
(1/1)
|
100%
(4/4)
|
50%
(3/6)
|
90.6%
(29/32)
|
package com.github.malyshevhen.domain.mapper;
import com.github.malyshevhen.domain.models.User;
import com.github.malyshevhen.dto.UserInfo;
import com.github.malyshevhen.dto.UserRegistrationForm;
import com.github.malyshevhen.dto.UserUpdateForm;
import javax.annotation.processing.Generated;
import org.springframework.stereotype.Component;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-04-30T13:11:40+0300",
comments = "version: 1.5.5.Final, compiler: javac, environment: Java 21.0.1 (Amazon.com Inc.)"
)
@Component
public class UserMapperImpl implements UserMapper {
@Override
public User toUser(UserRegistrationForm registrationForm) {
if ( registrationForm == null ) {
return null;
}
User.UserBuilder user = User.builder();
user.email( registrationForm.getEmail() );
user.firstName( registrationForm.getFirstName() );
user.lastName( registrationForm.getLastName() );
user.birthDate( registrationForm.getBirthDate() );
user.address( registrationForm.getAddress() );
user.phone( registrationForm.getPhone() );
return user.build();
}
@Override
public User toUser(UserUpdateForm updateForm) {
if ( updateForm == null ) {
return null;
}
User.UserBuilder user = User.builder();
user.email( updateForm.getEmail() );
user.firstName( updateForm.getFirstName() );
user.lastName( updateForm.getLastName() );
user.birthDate( updateForm.getBirthDate() );
user.address( updateForm.getAddress() );
user.phone( updateForm.getPhone() );
return user.build();
}
@Override
public UserInfo toUserInfo(User user) {
if ( user == null ) {
return null;
}
UserInfo userInfo = new UserInfo();
userInfo.setId( user.getId() );
userInfo.setEmail( user.getEmail() );
userInfo.setFirstName( user.getFirstName() );
userInfo.setLastName( user.getLastName() );
userInfo.setBirthDate( user.getBirthDate() );
userInfo.setAddress( user.getAddress() );
userInfo.setPhone( user.getPhone() );
return userInfo;
}
}