Skip to content

Test: AttachmentServiceTest – uppladdning, hämtning och radering #170

Description

@lindaeskilsson

Mocka: AttachmentRepository, FileStorageService, MedicalRecordRepository, AttachmentPolicy, MedicalRecordPolicy, AwsS3Properties
uploadAttachment:

  • Tom fil → IllegalArgumentException
  • Journal finns inte → ResourceNotFoundException
  • S3-uppladdning misslyckas → RuntimeException + ingen DB-post sparas
  • DB-sparning misslyckas → RuntimeException + S3-cleanup anropas
  • Lyckas → returnerar AttachmentResponse

getAttachment:

  • Hittar bilaga → anropar canDownload och returnerar AttachmentResponse
  • Finns inte → ResourceNotFoundException

deleteAttachment:

  • Hittar bilaga → anropar canDelete och attachmentRepository.delete
  • Finns inte → ResourceNotFoundException

getAttachmentsByRecord:

  • Journal finns → anropar canView och returnerar lista
  • Journal finns inte → ResourceNotFoundException

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions