Java tutorial
/******************************************************************************* * Copyright (c) 2005, 2014 springside.github.io * * Licensed under the Apache License, Version 2.0 (the "License"); *******************************************************************************/ package cn.aozhi.songify.functional.gui; import static org.assertj.core.api.Assertions.*; import org.junit.Test; import org.openqa.selenium.By; import cn.aozhi.songify.functional.BaseSeleniumTestCase; /** * , ?. * * @author calvin */ public class SecurityFT extends BaseSeleniumTestCase { /** * ??. */ @Test public void anonymousUserAccessSystem() { // ?,? s.open("/logout"); s.waitForTitleContains(""); // ??? s.open("/task"); s.waitForTitleContains(""); } /** * ?? */ @Test public void userTryToManageUsers() { loginAsUserIfNecessary(); s.open("/admin/user"); assertThat(s.getTitle()).isEqualTo("Error 401 Unauthorized"); } /** * ???. */ @Test public void loginWithWrongPassword() { s.open("/logout"); s.type(By.name("username"), "wrongUser"); s.type(By.name("password"), "WrongPassword"); s.check(By.name("rememberMe")); s.click(By.id("submit_btn")); s.waitForTitleContains(""); assertThat(s.isTextPresent("?.")).isTrue(); } }