File tree 2 files changed +6
-3
lines changed
src/test/groovy/ru/mystamps/web/feature/image
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -50,13 +50,14 @@ class DatabaseImagePersistenceStrategyTest extends Specification {
50
50
51
51
def " save() should convert IOException to ImagePersistenceException" () {
52
52
given :
53
- multipartFile. bytes >> { throw new IOException () }
53
+ multipartFile. bytes >> { throw new IOException (' oops ' ) }
54
54
when :
55
55
strategy. save(multipartFile, imageInfoDto)
56
56
then :
57
57
ImagePersistenceException ex = thrown()
58
58
and :
59
59
ex. cause instanceof IOException
60
+ ex. cause?. message == ' oops'
60
61
}
61
62
62
63
@SuppressWarnings ([' ClosureAsLastMethodParameter' , ' UnnecessaryReturnKeyword' ])
Original file line number Diff line number Diff line change @@ -83,13 +83,14 @@ class FilesystemImagePersistenceStrategyTest extends Specification {
83
83
84
84
def ' save() should convert IOException to ImagePersistenceException' () {
85
85
given :
86
- strategy. writeToFile(_ as MultipartFile , _ as Path ) >> { throw new IOException () }
86
+ strategy. writeToFile(_ as MultipartFile , _ as Path ) >> { throw new IOException (' oops ' ) }
87
87
when :
88
88
strategy. save(multipartFile, imageInfoDto)
89
89
then :
90
90
ImagePersistenceException ex = thrown()
91
91
and :
92
92
ex. cause instanceof IOException
93
+ ex. cause?. message == ' oops'
93
94
}
94
95
95
96
//
@@ -113,13 +114,14 @@ class FilesystemImagePersistenceStrategyTest extends Specification {
113
114
and :
114
115
strategy. generateFilePath(_ as File , _ as ImageInfoDto ) >> mockFile
115
116
and :
116
- strategy. toByteArray(_ as Path ) >> { throw new IOException () }
117
+ strategy. toByteArray(_ as Path ) >> { throw new IOException (' oops ' ) }
117
118
when :
118
119
strategy. get(imageInfoDto)
119
120
then :
120
121
ImagePersistenceException ex = thrown()
121
122
and :
122
123
ex. cause instanceof IOException
124
+ ex. cause?. message == ' oops'
123
125
}
124
126
125
127
def ' get() should return result with correct type and content' () {
You can’t perform that action at this time.
0 commit comments