TA 역할 Spring 경계 smoke #5

Open
forge-bot wants to merge 8 commits from forge/role-ta-live-v2-001-attempt-1-run-d1ca4511d09d into main
Showing only changes of commit d27fadcb86 - Show all commits

View file

@ -0,0 +1,36 @@
package com.runtimematrix.service;
import com.runtimematrix.domain.Role;
import com.runtimematrix.repository.RoleRepository;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
class RoleServiceTransactionTest {
@Autowired
private RoleService roleService;
@Autowired
private RoleRepository roleRepository;
@Test
@Transactional(readOnly = true)
void readOnlyTransaction_allowsRead() {
var roles = roleService.findAllRoles();
assertThat(roles).isNotNull();
}
@Test
void createRole_commitsSuccessfully() {
Role role = new Role(null, "TEST_ROLE", "Test Role");
Role saved = roleService.createRole(role);
assertThat(saved.getId()).isNotNull();
assertThat(roleRepository.findById(saved.getId())).isPresent();
}
}