@@ -79,13 +79,13 @@ class CellStyleBuilderSpec extends Specification {
7979 given :
8080 CellStyleBuilder cellStyleBuilder = new CellStyleBuilder (new XSSFWorkbook ())
8181 XSSFCellStyle cellStyle
82- Excel . registerCellFormat(String , " bar" )
82+ Excel . registerCellFormat(String , ' bar' )
8383
8484 when :
85- cellStyle = cellStyleBuilder. buildStyle(null , [format : " foo" ])
85+ cellStyle = cellStyleBuilder. buildStyle(null , [format : ' foo' ])
8686
8787 then :
88- cellStyle. dataFormatString == " foo"
88+ cellStyle. dataFormatString == ' foo'
8989
9090 when :
9191 cellStyle = cellStyleBuilder. buildStyle(null , [format : 1 ])
@@ -99,11 +99,11 @@ class CellStyleBuilderSpec extends Specification {
9999 then :
100100 thrown(IllegalArgumentException )
101101
102- when : " A call to getStyle is essential here to bring in the formats registered in Excel"
103- cellStyle = cellStyleBuilder. getStyle(" someString" , [:])
102+ when : ' A call to getStyle is essential here to bring in the formats registered in Excel'
103+ cellStyle = cellStyleBuilder. getStyle(' someString' , [:])
104104
105105 then :
106- cellStyle. dataFormatString == " bar"
106+ cellStyle. dataFormatString == ' bar'
107107 }
108108
109109 void " test buildStyle font" () {
@@ -115,7 +115,7 @@ class CellStyleBuilderSpec extends Specification {
115115 cellStyle = cellStyleBuilder. buildStyle(' ' , [font : 1 ])
116116
117117 then :
118- def ex = thrown(IllegalArgumentException )
118+ Exception ex = thrown(IllegalArgumentException )
119119 ex. message == ' The font option must be an instance of a Map'
120120
121121 when :
@@ -182,19 +182,19 @@ class CellStyleBuilderSpec extends Specification {
182182 cellStyle = cellStyleBuilder. buildStyle(' ' , [font : [color : ' FFFFFF' ]])
183183
184184 then :
185- cellStyle. font. getXSSFColor() . getRGB() == [255 , 255 , 255 ] as byte []
185+ cellStyle.font.XSSFColor . RGB == [255 , 255 , 255 ] as byte []
186186
187187 when :
188188 cellStyle = cellStyleBuilder. buildStyle(' ' , [font : [color : ' #000000' ]])
189189
190190 then :
191- cellStyle. font. getXSSFColor() . getRGB() == [0 , 0 , 0 ] as byte []
191+ cellStyle.font.XSSFColor . RGB == [0 , 0 , 0 ] as byte []
192192
193193 when :
194194 cellStyle = cellStyleBuilder. buildStyle(' ' , [font : [color : Color . BLUE ]])
195195
196196 then :
197- cellStyle. font. getXSSFColor() . getRGB() == [0 , 0 , 255 ] as byte []
197+ cellStyle.font.XSSFColor . RGB == [0 , 0 , 255 ] as byte []
198198
199199 when :
200200 cellStyle = cellStyleBuilder. buildStyle(' ' , [font : [color : 1L ]])
@@ -239,7 +239,7 @@ class CellStyleBuilderSpec extends Specification {
239239 ! cellStyle. hidden
240240
241241 when :
242- cellStyle = cellStyleBuilder. buildStyle(' ' , [hidden : " x " ])
242+ cellStyle = cellStyleBuilder. buildStyle(' ' , [hidden : ' x ' ])
243243
244244 then :
245245 thrown(IllegalArgumentException )
@@ -263,7 +263,7 @@ class CellStyleBuilderSpec extends Specification {
263263 ! cellStyle. locked
264264
265265 when :
266- cellStyle = cellStyleBuilder. buildStyle(' ' , [locked : " x " ])
266+ cellStyle = cellStyleBuilder. buildStyle(' ' , [locked : ' x ' ])
267267
268268 then :
269269 thrown(IllegalArgumentException )
@@ -287,7 +287,7 @@ class CellStyleBuilderSpec extends Specification {
287287 ! cellStyle. wrapText
288288
289289 when :
290- cellStyle = cellStyleBuilder. buildStyle(' ' , [wrapped : " x " ])
290+ cellStyle = cellStyleBuilder. buildStyle(' ' , [wrapped : ' x ' ])
291291
292292 then :
293293 thrown(IllegalArgumentException )
@@ -371,7 +371,7 @@ class CellStyleBuilderSpec extends Specification {
371371 cellStyle. rotation == (short )1
372372
373373 when :
374- cellStyle = cellStyleBuilder. buildStyle(' ' , [rotation : " foo" ])
374+ cellStyle = cellStyleBuilder. buildStyle(' ' , [rotation : ' foo' ])
375375
376376 then :
377377 thrown(ClassCastException )
@@ -395,7 +395,7 @@ class CellStyleBuilderSpec extends Specification {
395395 cellStyle. indention == (short )1
396396
397397 when :
398- cellStyle = cellStyleBuilder. buildStyle(' ' , [indent : " foo" ])
398+ cellStyle = cellStyleBuilder. buildStyle(' ' , [indent : ' foo' ])
399399
400400 then :
401401 thrown(ClassCastException )
@@ -414,30 +414,30 @@ class CellStyleBuilderSpec extends Specification {
414414
415415 when :
416416 cellStyle = cellStyleBuilder. buildStyle(' ' , [border : [style : BorderStyle . DOTTED , color : Color . RED ]])
417+ byte [] color = [255 , 0 , 0 ] as byte []
417418
418419 then :
419420 cellStyle. borderLeftEnum == BorderStyle . DOTTED
420- cellStyle. leftBorderXSSFColor. getRGB() == [ 255 , 0 , 0 ] as byte []
421+ cellStyle. leftBorderXSSFColor. RGB == color
421422 cellStyle. borderRightEnum == BorderStyle . DOTTED
422- cellStyle. rightBorderXSSFColor. getRGB() == [ 255 , 0 , 0 ] as byte []
423+ cellStyle. rightBorderXSSFColor. RGB == color
423424 cellStyle. borderBottomEnum == BorderStyle . DOTTED
424- cellStyle. bottomBorderXSSFColor. getRGB() == [ 255 , 0 , 0 ] as byte []
425+ cellStyle. bottomBorderXSSFColor. RGB == color
425426 cellStyle. borderTopEnum == BorderStyle . DOTTED
426- cellStyle. topBorderXSSFColor. getRGB() == [ 255 , 0 , 0 ] as byte []
427+ cellStyle. topBorderXSSFColor. RGB == color
427428
428429 when :
429- cellStyle = cellStyleBuilder. buildStyle(' ' , [border : [style : BorderStyle . DOTTED , color : Color . RED , left : [color : Color . BLUE ], right : [style : BorderStyle . DASHED ], bottom : [color : " FFFFFF" ], top : [color : " #000000" ]]])
430+ cellStyle = cellStyleBuilder. buildStyle(' ' , [border : [style : BorderStyle . DOTTED , color : Color . RED , left : [color : Color . BLUE ], right : [style : BorderStyle . DASHED ], bottom : [color : ' FFFFFF' ], top : [color : ' #000000' ]]])
430431
431432 then :
432433 cellStyle. borderLeftEnum == BorderStyle . DOTTED
433- cellStyle. leftBorderXSSFColor. getRGB() == [0 , 0 , 255 ] as byte []
434+ cellStyle. leftBorderXSSFColor. RGB == [0 , 0 , 255 ] as byte []
434435 cellStyle. borderRightEnum == BorderStyle . DASHED
435- cellStyle. rightBorderXSSFColor. getRGB() == [255 , 0 , 0 ] as byte []
436+ cellStyle. rightBorderXSSFColor. RGB == [255 , 0 , 0 ] as byte []
436437 cellStyle. borderBottomEnum == BorderStyle . DOTTED
437- cellStyle. bottomBorderXSSFColor. getRGB() == [255 , 255 , 255 ] as byte []
438+ cellStyle. bottomBorderXSSFColor. RGB == [255 , 255 , 255 ] as byte []
438439 cellStyle. borderTopEnum == BorderStyle . DOTTED
439- cellStyle. topBorderXSSFColor. getRGB() == [0 , 0 , 0 ] as byte []
440-
440+ cellStyle. topBorderXSSFColor. RGB == [0 , 0 , 0 ] as byte []
441441
442442 when :
443443 Map options = [border : [style : BorderStyle . DOTTED , left : BorderStyle . THIN ]]
@@ -469,13 +469,13 @@ class CellStyleBuilderSpec extends Specification {
469469 cellStyle. fillPatternEnum == FillPatternType . DIAMONDS
470470
471471 when :
472- cellStyle = cellStyleBuilder. buildStyle(' ' , [fill : " diamonds" ])
472+ cellStyle = cellStyleBuilder. buildStyle(' ' , [fill : ' diamonds' ])
473473
474474 then :
475475 cellStyle. fillPatternEnum == FillPatternType . DIAMONDS
476476
477477 when :
478- cellStyle = cellStyleBuilder. buildStyle(' ' , [fill : " x " ])
478+ cellStyle = cellStyleBuilder. buildStyle(' ' , [fill : ' x ' ])
479479
480480 then :
481481 thrown(IllegalArgumentException )
@@ -496,22 +496,22 @@ class CellStyleBuilderSpec extends Specification {
496496 cellStyle = cellStyleBuilder. buildStyle(' ' , [foregroundColor : Color . RED ])
497497
498498 then :
499- cellStyle. fillForegroundXSSFColor. getRGB() == [255 , 0 , 0 ] as byte []
499+ cellStyle. fillForegroundXSSFColor. RGB == [255 , 0 , 0 ] as byte []
500500
501501 when :
502- cellStyle = cellStyleBuilder. buildStyle(' ' , [foregroundColor : " FFFFFF" ])
502+ cellStyle = cellStyleBuilder. buildStyle(' ' , [foregroundColor : ' FFFFFF' ])
503503
504504 then :
505- cellStyle. fillForegroundXSSFColor. getRGB() == [255 , 255 , 255 ] as byte []
505+ cellStyle. fillForegroundXSSFColor. RGB == [255 , 255 , 255 ] as byte []
506506
507507 when :
508- cellStyle = cellStyleBuilder. buildStyle(' ' , [foregroundColor : " #000000" ])
508+ cellStyle = cellStyleBuilder. buildStyle(' ' , [foregroundColor : ' #000000' ])
509509
510510 then :
511- cellStyle. fillForegroundXSSFColor. getRGB() == [0 , 0 , 0 ] as byte []
511+ cellStyle. fillForegroundXSSFColor. RGB == [0 , 0 , 0 ] as byte []
512512
513513 when :
514- cellStyle = cellStyleBuilder. buildStyle(' ' , [foregroundColor : " blue" ])
514+ cellStyle = cellStyleBuilder. buildStyle(' ' , [foregroundColor : ' blue' ])
515515
516516 then :
517517 thrown(IllegalArgumentException )
@@ -522,35 +522,35 @@ class CellStyleBuilderSpec extends Specification {
522522 CellStyleBuilder cellStyleBuilder = new CellStyleBuilder (new XSSFWorkbook ())
523523 XSSFCellStyle cellStyle
524524
525- when : " Only the background color is specified"
525+ when : ' Only the background color is specified'
526526 cellStyle = cellStyleBuilder. buildStyle(' ' , [backgroundColor : Color . RED ])
527527
528- then : " The foreground color is set instead of the background and the fill pattern is set to solid"
529- cellStyle. fillForegroundXSSFColor. getRGB() == [255 , 0 , 0 ] as byte []
528+ then : ' The foreground color is set instead of the background and the fill pattern is set to solid'
529+ cellStyle. fillForegroundXSSFColor. RGB == [255 , 0 , 0 ] as byte []
530530 cellStyle. fillBackgroundXSSFColor == null
531531 cellStyle. fillPatternEnum == FillPatternType . SOLID_FOREGROUND
532532
533- when : " Both the foreground and background colors are specified"
533+ when : ' Both the foreground and background colors are specified'
534534 cellStyle = cellStyleBuilder. buildStyle(' ' , [foregroundColor : Color . BLUE , backgroundColor : Color . RED ])
535535
536- then : " Both are set"
537- cellStyle. fillForegroundXSSFColor. getRGB() == [0 , 0 , 255 ] as byte []
538- cellStyle. fillBackgroundXSSFColor. getRGB() == [255 , 0 , 0 ] as byte []
536+ then : ' Both are set'
537+ cellStyle. fillForegroundXSSFColor. RGB == [0 , 0 , 255 ] as byte []
538+ cellStyle. fillBackgroundXSSFColor. RGB == [255 , 0 , 0 ] as byte []
539539
540540 when :
541- cellStyle = cellStyleBuilder. buildStyle(' ' , [backgroundColor : " FFFFFF" ])
541+ cellStyle = cellStyleBuilder. buildStyle(' ' , [backgroundColor : ' FFFFFF' ])
542542
543543 then :
544- cellStyle. fillForegroundXSSFColor. getRGB() == [255 , 255 , 255 ] as byte []
544+ cellStyle. fillForegroundXSSFColor. RGB == [255 , 255 , 255 ] as byte []
545545
546546 when :
547- cellStyle = cellStyleBuilder. buildStyle(' ' , [backgroundColor : " #000000" ])
547+ cellStyle = cellStyleBuilder. buildStyle(' ' , [backgroundColor : ' #000000' ])
548548
549549 then :
550- cellStyle. fillForegroundXSSFColor. getRGB() == [0 , 0 , 0 ] as byte []
550+ cellStyle. fillForegroundXSSFColor. RGB == [0 , 0 , 0 ] as byte []
551551
552552 when :
553- cellStyle = cellStyleBuilder. buildStyle(' ' , [backgroundColor : " blue" ])
553+ cellStyle = cellStyleBuilder. buildStyle(' ' , [backgroundColor : ' blue' ])
554554
555555 then :
556556 thrown(IllegalArgumentException )
@@ -583,7 +583,6 @@ class CellStyleBuilderSpec extends Specification {
583583 cell. cellStyle == defaultCell. cellStyle
584584 }
585585
586-
587586 void " test setStyle cell options" () {
588587 given :
589588 XSSFWorkbook workbook = new XSSFWorkbook ()
0 commit comments