chore: add test
Release package / release (push) Successful in 2m25s

This commit is contained in:
TranHuuDanh
2026-03-24 09:20:02 +00:00
parent 1af8c04e32
commit 37bf5de999
@@ -0,0 +1,37 @@
package com.drinkool;
import static org.junit.jupiter.api.Assertions.*;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.transaction.Transactional;
import org.junit.jupiter.api.Test;
import com.drinkool.entities.CustomerEntity;
import java.util.*;
@QuarkusTest
class CustomerSignupTest {
@Test
// @TestIransaction
@Transactional
public void testSignupSuccess() {
//dang nhap thanh cong
CustomerEntity user = new CustomerEntity();
String phone = "+8477" + String.format("%07d", (new Random()).nextInt(10000000));
String password = "02092006Danh";
user.signup("Tran Huu Danh", phone, password);
assertNotNull(user.id, "ID not null after persist");
assertEquals("Tran Huu Danh", user.name);
assertEquals(phone,user.phone);
assertNotNull(user.hashedPassword, "password phai hash");
CustomerEntity savedUser = CustomerEntity.find("phone",phone).firstResult();
assertNotNull(savedUser);
}
// 2. Test case: Đăng ký thất bại do số điện thoại đã tồn tại
// 3. Test case: Đăng ký thất bại do số điện thoại sai định dạng
}