ソースを参照

Fix hello-security-explicit checkstyle

Rob Winch 5 年 前
コミット
67ea8e7438

+ 8 - 7
servlet/spring-boot/java/hello-security-explicit/src/integTest/java/example/HelloSecurityExplicitITests.java

@@ -22,10 +22,13 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.htmlunit.HtmlUnitDriver;
+
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.web.server.LocalServerPort;
 
 /**
+ * Integration tests.
+ *
  * @author Michael Simons
  */
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -37,27 +40,25 @@ public class HelloSecurityExplicitITests {
 	private int port;
 
 	@BeforeEach
-	public void setup() {
+	void setup() {
 		this.driver = new HtmlUnitDriver();
 	}
 
 	@AfterEach
-	public void tearDown() {
+	void tearDown() {
 		this.driver.quit();
 	}
 
 	@Test
-	public void login() {
+	void login() {
 		final LoginPage loginPage = HomePage.to(this.driver, this.port);
 		loginPage.assertAt();
 
-		HomePage homePage = loginPage.loginForm()
-				.username("user")
-				.password("password")
-				.submit();
+		HomePage homePage = loginPage.loginForm().username("user").password("password").submit();
 		homePage.assertAt();
 
 		LoginPage logoutSuccess = homePage.logout();
 		logoutSuccess.assertAt();
 	}
+
 }

+ 5 - 1
servlet/spring-boot/java/hello-security-explicit/src/integTest/java/example/pages/HomePage.java

@@ -23,16 +23,19 @@ import org.openqa.selenium.support.PageFactory;
 import static org.assertj.core.api.Assertions.assertThat;
 
 /**
+ * The home page.
+ *
  * @author Michael Simons
  */
 public class HomePage {
+
 	private final WebDriver webDriver;
 
 	@FindBy(id = "logout")
 	private WebElement logout;
 
 	public static LoginPage to(WebDriver driver, int port) {
-		driver.get("http://localhost:" + port +"/");
+		driver.get("http://localhost:" + port + "/");
 		return PageFactory.initElements(driver, LoginPage.class);
 	}
 
@@ -49,4 +52,5 @@ public class HomePage {
 		this.logout.click();
 		return PageFactory.initElements(this.webDriver, LogoutConfirmPage.class).logout();
 	}
+
 }

+ 8 - 0
servlet/spring-boot/java/hello-security-explicit/src/integTest/java/example/pages/LoginPage.java

@@ -23,6 +23,8 @@ import org.openqa.selenium.support.PageFactory;
 import static org.assertj.core.api.Assertions.assertThat;
 
 /**
+ * The login page.
+ *
  * @author Michael Simons
  */
 public class LoginPage {
@@ -46,9 +48,13 @@ public class LoginPage {
 	}
 
 	public static class LoginForm {
+
 		private WebDriver webDriver;
+
 		private WebElement username;
+
 		private WebElement password;
+
 		@FindBy(css = "button[type=submit]")
 		private WebElement submit;
 
@@ -70,5 +76,7 @@ public class LoginPage {
 			this.submit.click();
 			return PageFactory.initElements(this.webDriver, HomePage.class);
 		}
+
 	}
+
 }

+ 29 - 21
servlet/spring-boot/java/hello-security-explicit/src/integTest/java/example/pages/LogoutConfirmPage.java

@@ -21,33 +21,41 @@ import org.openqa.selenium.WebElement;
 import org.openqa.selenium.support.FindBy;
 import org.openqa.selenium.support.PageFactory;
 
+/**
+ * The log out confirmation page.
+ * @author Rob Winch
+ */
 public class LogoutConfirmPage {
 
-    private final WebDriver webDriver;
+	private final WebDriver webDriver;
+
+	private final LogoutConfirmPage.LogoutForm logoutForm;
+
+	public LogoutConfirmPage(WebDriver webDriver) {
+		this.webDriver = webDriver;
+		this.logoutForm = PageFactory.initElements(this.webDriver, LogoutForm.class);
+	}
+
+	public LoginPage logout() {
+		return this.logoutForm.logout();
+	}
+
+	public static class LogoutForm {
 
-    private final LogoutConfirmPage.LogoutForm logoutForm;
+		private WebDriver webDriver;
 
-    public LogoutConfirmPage(WebDriver webDriver) {
-        this.webDriver = webDriver;
-        this.logoutForm = PageFactory.initElements(this.webDriver, LogoutForm.class);
-    }
+		@FindBy(css = "button[type=submit]")
+		private WebElement submit;
 
-    public LoginPage logout() {
-        return this.logoutForm.logout();
-    }
+		public LogoutForm(WebDriver webDriver) {
+			this.webDriver = webDriver;
+		}
 
-    public static class LogoutForm {
-        private WebDriver webDriver;
-        @FindBy(css = "button[type=submit]")
-        private WebElement submit;
+		public LoginPage logout() {
+			this.submit.click();
+			return PageFactory.initElements(this.webDriver, LoginPage.class);
+		}
 
-        public LogoutForm(WebDriver webDriver) {
-            this.webDriver = webDriver;
-        }
+	}
 
-        public LoginPage logout() {
-            this.submit.click();
-            return PageFactory.initElements(this.webDriver, LoginPage.class);
-        }
-    }
 }