Created
February 10, 2022 00:38
-
-
Save httpmurilo/32b134fef6e8a29565dd8aee76720c5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.httpmurilo.sales.mock; | |
import io.httpmurilo.sales.dto.UserDTO; | |
import io.httpmurilo.sales.entity.User; | |
import io.httpmurilo.sales.mapper.UserMapper; | |
import org.springframework.beans.factory.annotation.Autowired; | |
public class FakeService { | |
@Autowired | |
private FakeRepository repository; //INJETA UM REPOSITORY FAKE | |
public User save(UserDTO dto) { // PASSAMOS COMO PARÂMETRO NOSSO DTO | |
return repository.save(UserMapper.INSTANCE.toUser(dto)); //CONVERTEMOS PARA UM OBJETO USER QUE PODERÁ SER RE-APROVEITADO APÓS O SALVAMENTO | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment