package Ġio . andre wo h ara . aws mock . s 3 . v 1 Ċ Ċ import Ġcom . amazonaws . services . s 3 . model . Amazon S 3 Exception Ċ import Ġio . andre wo h ara . aws mock . s 3 . Mock S 3 Backend Ċ import Ġio . andre wo h ara . aws mock . s 3 . Mock S 3 V 1 Ċ import Ġorg . assertj . core . api . Assertions .* Ċ import Ġorg . junit . jupiter . api . Test Ċ Ċ class ĠMock S 3 V 1 Create Bucket UnitTest Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġbackend Ġ= ĠMock S 3 Backend () ĊĠĠĠ Ġprivate Ġval Ġtest Obj Ġ= ĠMock S 3 V 1 ( backend ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` create Ġbucket `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbucket Ġ= Ġtest Obj . create Bucket (" bucket ") ĊĊĠĠĠĠĠĠĠ ĠassertThat ( bucket . name ). isEqualTo (" bucket ") ĊĠĠĠĠĠĠĠ ĠassertThat ( backend [" bucket "]). isNotNull ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` create Ġbucket Ġthat Ġalready Ġexists `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbucket Ġ= Ġbackend . create (" bucket ") !! ĊĠĠĠĠĠĠĠ Ġbucket [" foo "] Ġ= Ġ" bar " ĊĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtest Obj . create Bucket (" bucket ") ĊĠĠĠĠĠĠĠ Ġ}. isInstanceOf ( Amazon S 3 Exception :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Message Containing (" already Ġexists ") ĊĊĠĠĠĠĠĠĠ ĠassertThat ( backend . buckets ()). has Size ( 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` create Ġsecond Ġbucket `() Ġ{ ĊĠĠĠĠĠĠĠ Ġbackend . create (" bucket 1 ") ĊĠĠĠĠĠĠĠ Ġtest Obj . create Bucket (" bucket 2 ") ĊĊĠĠĠĠĠĠĠ ĠassertThat ( backend . buckets (). map Ġ{ Ġit . name Ġ}). contains Exactly In Any Order (" bucket 1 ", Ġ" bucket 2 ") ĊĠĠĠ Ġ} Ċ }