1414 * limitations under the License.
1515 */
1616
17- package app ;
18-
1917import static com .google .common .truth .Truth .assertThat ;
2018import static com .google .common .truth .Truth .assertWithMessage ;
2119
3836import org .junit .BeforeClass ;
3937import org .junit .Ignore ;
4038import org .junit .Test ;
41- import org .junit .runner .RunWith ;
4239import org .openqa .selenium .By ;
4340import org .openqa .selenium .JavascriptExecutor ;
4441import org .openqa .selenium .SearchContext ;
5148import org .springframework .boot .test .context .SpringBootTest ;
5249import org .springframework .boot .test .context .SpringBootTest .WebEnvironment ;
5350import org .springframework .boot .test .web .server .LocalServerPort ;
54- import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
5551import org .springframework .web .util .UriComponentsBuilder ;
5652
57- @ RunWith (SpringJUnit4ClassRunner .class )
5853@ EnableAutoConfiguration
5954@ SpringBootTest (webEnvironment = WebEnvironment .RANDOM_PORT )
6055@ Ignore
@@ -69,16 +64,16 @@ public class ScoreKeyIT {
6964 // CSS selector of reCAPTCHA button in /home page. Used to execute Javascript actions.
7065 private static final String HOME_BUTTON_SELECTOR = "#example > button" ;
7166
72- // CSS selector of reCAPTCHA button in all pages, except /home. Used to execute Javascript actions.
67+ // CSS selector of reCAPTCHA button in all pages, except /home. Used to execute Javascript
68+ // actions.
7369 private static final String BUTTON_SELECTOR = "button" ;
7470
7571 // CSS selector of reCAPTCHA result in page. Used to execute Javascript actions.
7672 private static final String RESULT_SELECTOR = "#result pre" ;
7773
7874 private static final String SHADOW_HOST_SELECTOR = "recaptcha-demo" ;
7975 private static WebDriver browser ;
80- @ LocalServerPort
81- private int randomServerPort ;
76+ @ LocalServerPort private int randomServerPort ;
8277
8378 private ByteArrayOutputStream stdOut ;
8479
@@ -95,7 +90,7 @@ public static void setUp() throws IOException, InterruptedException {
9590 requireEnvVar ("GOOGLE_CLOUD_PROJECT" );
9691
9792 // Create reCAPTCHA Score key.
98- RECAPTCHA_SITE_KEY = app . Util .createSiteKey (PROJECT_ID , DOMAIN_NAME , IntegrationType .SCORE );
93+ RECAPTCHA_SITE_KEY = Util .createSiteKey (PROJECT_ID , DOMAIN_NAME , IntegrationType .SCORE );
9994 TimeUnit .SECONDS .sleep (5 );
10095
10196 // Set Selenium Driver to Chrome.
@@ -110,7 +105,7 @@ public static void cleanUp()
110105 ByteArrayOutputStream stdOut = new ByteArrayOutputStream ();
111106 System .setOut (new PrintStream (stdOut ));
112107
113- app . Util .deleteSiteKey (PROJECT_ID , RECAPTCHA_SITE_KEY );
108+ Util .deleteSiteKey (PROJECT_ID , RECAPTCHA_SITE_KEY );
114109 assertThat (stdOut .toString ()).contains ("reCAPTCHA Site key successfully deleted !" );
115110
116111 browser .quit ();
@@ -133,22 +128,20 @@ public void afterEach() {
133128
134129 // Construct the page URL with necessary context parameters.
135130 public static String makeRequest (String url , String siteKey ) throws MalformedURLException {
136- return
137- UriComponentsBuilder .fromUriString (url )
138- .queryParam ("project_id" , PROJECT_ID )
139- .queryParam ("site_key" , siteKey )
140- .build ()
141- .encode ()
142- .toUri ()
143- .toURL ()
144- .toString ();
131+ return UriComponentsBuilder .fromUriString (url )
132+ .queryParam ("project_id" , PROJECT_ID )
133+ .queryParam ("site_key" , siteKey )
134+ .build ()
135+ .encode ()
136+ .toUri ()
137+ .toURL ()
138+ .toString ();
145139 }
146140
147141 // Retrieve page and click the button specified by the element to obtain
148142 // response and redirect URL.
149- public ImmutableMap <String , String > browserTest (String pageUrl , String buttonXPath ,
150- String resultXPath ,
151- boolean scoreOnPageLoad )
143+ public ImmutableMap <String , String > browserTest (
144+ String pageUrl , String buttonXPath , String resultXPath , boolean scoreOnPageLoad )
152145 throws JSONException , InterruptedException {
153146 browser .get (pageUrl );
154147
0 commit comments