Skip to content

Commit a15ea13

Browse files
committed
TimedImagePreviewStrategyTest: improve test to cover possible NPE.
No functional changes.
1 parent aa2f78f commit a15ea13

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/test/groovy/ru/mystamps/web/service/TimedImagePreviewStrategyTest.groovy

+11-7
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ class TimedImagePreviewStrategyTest extends Specification {
3838
//
3939

4040
@Unroll
41-
@SuppressWarnings(['ClosureAsLastMethodParameter', 'FactoryMethodName', 'UnnecessaryReturnKeyword'])
42-
def 'createPreview() should pass #expectedData and return result of original strategy'(byte[] expectedData) {
43-
given:
44-
byte[] expectedResult = 'foobar'.bytes
41+
@SuppressWarnings([
42+
'ClosureAsLastMethodParameter',
43+
'FactoryMethodName',
44+
'LineLength',
45+
'UnnecessaryReturnKeyword',
46+
/* false positive: */ 'UnnecessaryBooleanExpression',
47+
])
48+
def 'createPreview() should pass #expectedData and return #expectedResult'(byte[] expectedData, byte[] expectedResult) {
4549
when:
4650
byte[] result = strategy.createPreview(expectedData)
4751
then:
@@ -52,9 +56,9 @@ class TimedImagePreviewStrategyTest extends Specification {
5256
and:
5357
result == expectedResult
5458
where:
55-
expectedData | _
56-
null | _
57-
'foo'.bytes | _
59+
expectedData || expectedResult
60+
null || null
61+
'foo'.bytes || 'foobar'.bytes
5862
}
5963

6064
}

0 commit comments

Comments
 (0)