@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user