@@ -479,7 +479,11 @@ public <X> void beforeGetScreenshotAs(WebElement element, OutputType<X> target)
479479
480480 @ Override
481481 public <X > void afterGetScreenshotAs (WebElement element , OutputType <X > target , X result ) {
482- acc .append ("afterGetScreenshotAs " ).append (target ).append (" " ).append (result ).append ("\n " );
482+ acc .append ("afterGetScreenshotAs " )
483+ .append (target )
484+ .append (" " )
485+ .append (result )
486+ .append ("\n " );
483487 }
484488 };
485489
@@ -999,31 +1003,35 @@ void shouldFireWebDriverTakesScreenshotEvents() {
9991003 when (((TakesScreenshot ) driver ).getScreenshotAs (OutputType .BASE64 )).thenReturn (result );
10001004
10011005 CollectorListener listener =
1002- new CollectorListener () {
1003- @ Override
1004- public <X > void beforeGetScreenshotAs (WebDriver driver , OutputType <X > target ) {
1005- acc .append ("beforeGetScreenshotAs " ).append (target ).append ("\n " );
1006- }
1007-
1008- @ Override
1009- public <X > void afterGetScreenshotAs (WebDriver driver , OutputType <X > target , X result ) {
1010- acc .append ("afterGetScreenshotAs " ).append (target ).append (" " ).append (result ).append ("\n " );
1011- }
1012- };
1006+ new CollectorListener () {
1007+ @ Override
1008+ public <X > void beforeGetScreenshotAs (WebDriver driver , OutputType <X > target ) {
1009+ acc .append ("beforeGetScreenshotAs " ).append (target ).append ("\n " );
1010+ }
1011+
1012+ @ Override
1013+ public <X > void afterGetScreenshotAs (WebDriver driver , OutputType <X > target , X result ) {
1014+ acc .append ("afterGetScreenshotAs " )
1015+ .append (target )
1016+ .append (" " )
1017+ .append (result )
1018+ .append ("\n " );
1019+ }
1020+ };
10131021 WebDriver decorated = new EventFiringDecorator <>(listener ).decorate (driver );
10141022
10151023 ((TakesScreenshot ) decorated ).getScreenshotAs (OutputType .BASE64 );
10161024
10171025 assertThat (listener .acc .toString ().trim ())
1018- .isEqualTo (
1019- String .join (
1020- "\n " ,
1021- "beforeAnyCall getScreenshotAs" ,
1022- "beforeAnyWebDriverCall getScreenshotAs" ,
1023- "beforeGetScreenshotAs OutputType.BASE64" ,
1024- "afterGetScreenshotAs OutputType.BASE64 " + result ,
1025- "afterAnyWebDriverCall getScreenshotAs" ,
1026- "afterAnyCall getScreenshotAs" ));
1026+ .isEqualTo (
1027+ String .join (
1028+ "\n " ,
1029+ "beforeAnyCall getScreenshotAs" ,
1030+ "beforeAnyWebDriverCall getScreenshotAs" ,
1031+ "beforeGetScreenshotAs OutputType.BASE64" ,
1032+ "afterGetScreenshotAs OutputType.BASE64 " + result ,
1033+ "afterAnyWebDriverCall getScreenshotAs" ,
1034+ "afterAnyCall getScreenshotAs" ));
10271035 }
10281036
10291037 @ Test
0 commit comments