Files
backend/account-service/src/test/java/com/drinkool/services/BaseServiceTest.java
T
2026-05-06 15:25:01 +00:00

47 lines
1.0 KiB
Java

package com.drinkool.services;
import static io.restassured.RestAssured.*;
import static org.hamcrest.CoreMatchers.*;
import com.drinkool.*;
import com.drinkool.lib.dtos.*;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.Test;
@QuarkusTest
public class BaseServiceTest {
@Test
public void testMeEndpointWithHeader() {
String phone = Utils.generateRandomPhone();
Signup input = new Signup();
input.name = "Test User";
input.phone = phone;
input.password = "password123";
String testUserId = given()
.contentType(ContentType.JSON)
.body(input)
.when()
.post(Role.Customer + Url.Signup)
.then()
.extract()
.header(InternalValue.userId);
given()
.header(InternalValue.userId, testUserId)
.contentType(ContentType.JSON)
.when()
.get(Role.Customer + Url.Me)
.then()
.statusCode(200)
.body("id", is(testUserId));
}
@Test
public void testMeEndpointWithoutHeader() {
given().when().get(Role.Customer + Url.Me).then().statusCode(400);
}
}