TA 역할 Spring 경계 smoke (role-ta-live-v2-001)
Some checks failed
ci / test (pull_request) Failing after 5s
Some checks failed
ci / test (pull_request) Failing after 5s
This commit is contained in:
parent
66083b8c61
commit
d27fadcb86
1 changed files with 36 additions and 0 deletions
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue