Skip to content

Commit 27e4f74

Browse files
kangcheolungclaude
andcommitted
test: 엔티티 오버로드의 soft-delete 방어 로직 검증 테스트 추가
소유자여도 삭제된 컬렉션 엔티티를 canReadCollection에 직접 넘기면 COLLECTION_NOT_FOUND가 발생하는지 검증한다. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 091cea0 commit 27e4f74

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/test/java/com/opensource/docgrid/domain/permission/service/query/PermissionQueryServiceTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,18 @@ void canReadCollection_collectionDeleted_throwsException() {
434434
.hasFieldOrPropertyWithValue("errorCode", ErrorCode.COLLECTION_NOT_FOUND);
435435
}
436436

437+
@Test
438+
@DisplayName("삭제된 컬렉션 엔티티를 직접 넘기면 소유자여도 canReadCollection 호출 시 COLLECTION_NOT_FOUND 예외가 발생한다")
439+
void canReadCollection_entityOverload_rejectsDeletedCollection_evenForOwner() {
440+
User owner = CollectionFixture.createOwner();
441+
DocumentCollection collection = CollectionFixture.createCollection(owner);
442+
org.springframework.test.util.ReflectionTestUtils.setField(collection, "status", com.opensource.docgrid.domain.collection.enums.CollectionStatus.DELETED);
443+
444+
assertThatThrownBy(() -> service.canReadCollection(CollectionFixture.USER_ID, collection))
445+
.isInstanceOf(DocGridException.class)
446+
.hasFieldOrPropertyWithValue("errorCode", ErrorCode.COLLECTION_NOT_FOUND);
447+
}
448+
437449
// ==================== canWriteCollection ====================
438450

439451
@Test

0 commit comments

Comments
 (0)