업무_메모

TestUser 생성.java

shine94 2023. 6. 12. 14:20
public class AdminUserTest extends ApplicationTests {

    private AdminUserRepository adminUserRepository;

    @Autowired
    public AdminUserTest(AdminUserRepository adminUserRepository) {
        this.adminUserRepository = adminUserRepository;
    }

    @Test
    public void createAminUser() {
        AdminUser user = AdminUser.builder()
                .username("아이디")
                .password(new BCryptPasswordEncoder().encode("비밀번호"))
                .name("이름")
                .role(AdminRoleType.ROLE_MASTER)
                .build();

        adminUserRepository.save(user);
    }

}