Skip to content

Commit

Permalink
moar javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeis committed Sep 27, 2015
1 parent d445133 commit 9888ad4
Show file tree
Hide file tree
Showing 29 changed files with 278 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ protected boolean isMultiWindow() {

/**
* Sets {@code SINGLE_WINDOW} and unsets {@code MULTI_WINDOW}.
*
* @return this / self
*/
public BrowserConfigurationOptions setSingleWindow() {
synchronized (options) {
Expand All @@ -133,6 +135,8 @@ public BrowserConfigurationOptions setSingleWindow() {

/**
* Sets {@code MULTI_WINDOW} and unsets {@code SINGLE_WINDOW}
*
* @return this / self
*/
public BrowserConfigurationOptions setMultiWindow() {
synchronized (options) {
Expand All @@ -151,6 +155,7 @@ protected String getBrowserExecutablePath() {
* Sets the full path for the browser executable.
*
* @param executablePath the full path for the browser executable.
* @return this / self
*/
public BrowserConfigurationOptions setBrowserExecutablePath(String executablePath) {
put(BROWSER_EXECUTABLE_PATH, executablePath);
Expand Down Expand Up @@ -186,6 +191,7 @@ protected int getTimeoutInSeconds() {
* "HTA" has yet been done. Use at your own risk until this is rectified.
*
* @param mode - examples "HTA" or "PROXY"
* @return this / self
*/
public BrowserConfigurationOptions setBrowserMode(String mode) {
put(BROWSER_MODE, mode);
Expand Down Expand Up @@ -234,6 +240,7 @@ public String get(String key) {
*
* @param key the name of the key
* @param value the value for the key
* @return this / self
*/
public BrowserConfigurationOptions set(String key, String value) {
if (value != null) {
Expand All @@ -243,7 +250,7 @@ public BrowserConfigurationOptions set(String key, String value) {
}

/**
* Returns the serialization of this object, as defined by the serialize() method.
* @return the serialization of this object, as defined by the serialize() method.
*/
@Override
public String toString() {
Expand Down
14 changes: 11 additions & 3 deletions java/client/src/com/thoughtworks/selenium/CommandProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,24 @@ public interface CommandProcessor {
*/
String doCommand(String command, String[] args);

/** Sets extension Javascript for the session */
/**
* Sets extension Javascript for the session
*
* @param extensionJs extension javascript
*/
public void setExtensionJs(String extensionJs);

/** Starts a new Selenium testing session */
public void start();

/** Starts a new Selenium testing session with a String, representing a configuration */
/** Starts a new Selenium testing session with a String, representing a configuration
* @param optionsString option string
*/
public void start(String optionsString);

/** Starts a new Selenium testing session with a configuration options object */
/** Starts a new Selenium testing session with a configuration options object
* @param optionsObject options object
*/
public void start(Object optionsObject);

/** Ends the current Selenium testing session (normally killing the browser) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ public String toString() {
return getCommandURLString();
}

/** Factory method to create a RemoteCommand from a wiki-style input string */
/** Factory method to create a RemoteCommand from a wiki-style input string
* @param inputLine wiki-style input string
* @return RemoteCommand
*/
public static RemoteCommand parse(String inputLine) {
if (null == inputLine) throw new NullPointerException("inputLine can't be null");
String[] values = inputLine.split("\\|");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ private CommandProcessor detectCommandProcessor(String serverHost, int serverPor
return new HttpCommandProcessor(serverHost, serverPort, browserStartCommand, browserURL);
}

/** Uses an arbitrary CommandProcessor */
/** Uses an arbitrary CommandProcessor
* @param processor Command Processor to use
*/
public DefaultSelenium(CommandProcessor processor) {
this.commandProcessor = processor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ protected String throwAssertionFailureExceptionOrError(String message) {
throw new SeleniumException(message);
}

/** Sends the specified command string to the bridge servlet */
/** Sends the specified command string to the bridge servlet
* @param command command to execute
* @return response from the command execution
*/
public String executeCommandOnServlet(String command) {
try {
return getCommandResponseAsString(command);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
* @version $Id: $
*/
public interface RemoteCommand {
/** Return the URL query string which will be sent to the browser */
/** @return the URL query string which will be sent to the browser */
String getCommandURLString();
}
76 changes: 60 additions & 16 deletions java/client/src/com/thoughtworks/selenium/SeleneseTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* @deprecated The RC interface will be removed in Selenium 3.0. Please migrate to using WebDriver.
*/
@Deprecated
@SuppressWarnings("JavaDoc")
public class SeleneseTestBase {

private static final boolean THIS_IS_WINDOWS = File.pathSeparator.equals(";");
Expand All @@ -57,6 +58,7 @@ public SeleneseTestBase() {
* Calls this.setUp(null)
*
* @see #setUp(String)
* @throws Exception because why not
*/
public void setUp() throws Exception {
this.setUp(null);
Expand All @@ -69,7 +71,7 @@ public void setUp() throws Exception {
*
* @see #setUp(String, String)
* @param url the baseUrl to use for your Selenium tests
* @throws Exception
* @throws Exception just in case
*
*/
public void setUp(String url) throws Exception {
Expand Down Expand Up @@ -100,6 +102,7 @@ protected String runtimeBrowserString() {
* @see #setUp(String, String, int)
* @param url the baseUrl for your tests
* @param browserString the browser to use, e.g. *firefox
* @throws Exception throws them all!
*/
public void setUp(String url, String browserString) throws Exception {
setUp(url, browserString, getDefaultPort());
Expand All @@ -126,7 +129,7 @@ protected int getDefaultPort() {
* @param url the baseUrl for your tests
* @param browserString the browser to use, e.g. *firefox
* @param port the port that you want to run your tests on
* @throws Exception
* @throws Exception exception all the things!
*/
public void setUp(String url, String browserString, int port) throws Exception {
if (url == null) {
Expand All @@ -136,7 +139,9 @@ public void setUp(String url, String browserString, int port) throws Exception {
selenium.start();
}

/** Like assertTrue, but fails at the end of the test (during tearDown) */
/** Like assertTrue, but fails at the end of the test (during tearDown)
* @param b boolean to verify is true
*/
public void verifyTrue(boolean b) {
try {
assertTrue(b);
Expand All @@ -145,7 +150,9 @@ public void verifyTrue(boolean b) {
}
}

/** Like assertFalse, but fails at the end of the test (during tearDown) */
/** Like assertFalse, but fails at the end of the test (during tearDown)
* @param b boolean to verify is false
*/
public void verifyFalse(boolean b) {
try {
assertFalse(b);
Expand All @@ -154,12 +161,15 @@ public void verifyFalse(boolean b) {
}
}

/** Returns the body text of the current page */
/** @return the body text of the current page */
public String getText() {
return selenium.getEval("this.page().bodyText()");
}

/** Like assertEquals, but fails at the end of the test (during tearDown) */
/** Like assertEquals, but fails at the end of the test (during tearDown)
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public void verifyEquals(Object expected, Object actual) {
try {
assertEquals(expected, actual);
Expand All @@ -168,7 +178,10 @@ public void verifyEquals(Object expected, Object actual) {
}
}

/** Like assertEquals, but fails at the end of the test (during tearDown) */
/** Like assertEquals, but fails at the end of the test (during tearDown)
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public void verifyEquals(boolean expected, boolean actual) {
try {
assertEquals(Boolean.valueOf(expected), Boolean.valueOf(actual));
Expand All @@ -177,7 +190,10 @@ public void verifyEquals(boolean expected, boolean actual) {
}
}

/** Like JUnit's Assert.assertEquals, but knows how to compare string arrays */
/** Like JUnit's Assert.assertEquals, but knows how to compare string arrays
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public static void assertEquals(Object expected, Object actual) {
if (expected == null) {
assertTrue("Expected \"" + expected + "\" but saw \"" + actual + "\" instead", actual == null);
Expand All @@ -197,7 +213,10 @@ public static void assertEquals(Object expected, Object actual) {
}
}

/** Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese */
/** Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public static void assertEquals(String expected, String actual) {
assertTrue("Expected \"" + expected + "\" but saw \"" + actual + "\" instead",
seleniumEquals(expected, actual));
Expand All @@ -206,6 +225,8 @@ public static void assertEquals(String expected, String actual) {
/**
* Like JUnit's Assert.assertEquals, but joins the string array with commas, and handles "regexp:"
* strings like HTML Selenese
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public static void assertEquals(String expected, String[] actual) {
assertEquals(expected, join(actual, ','));
Expand Down Expand Up @@ -286,6 +307,8 @@ private static Boolean handleRegex(String prefix, String expectedPattern, String
* Compares two objects, but handles "regexp:" strings like HTML Selenese
*
* @see #seleniumEquals(String, String)
* @param actual the actual object expected
* @param expected object that you want to compare to actual
* @return true if actual matches the expectedPattern, or false otherwise
*/
public static boolean seleniumEquals(Object expected, Object actual) {
Expand All @@ -298,7 +321,10 @@ public static boolean seleniumEquals(Object expected, Object actual) {
return expected.equals(actual);
}

/** Asserts that two string arrays have identical string contents */
/** Asserts that two string arrays have identical string contents
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public static void assertEquals(String[] expected, String[] actual) {
String comparisonDumpIfNotEqual = verifyEqualsAndReturnComparisonDumpIfNot(expected, actual);
if (comparisonDumpIfNotEqual != null) {
Expand All @@ -309,6 +335,8 @@ public static void assertEquals(String[] expected, String[] actual) {
/**
* Asserts that two string arrays have identical string contents (fails at the end of the test,
* during tearDown)
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public void verifyEquals(String[] expected, String[] actual) {
String comparisonDumpIfNotEqual = verifyEqualsAndReturnComparisonDumpIfNot(expected, actual);
Expand Down Expand Up @@ -362,7 +390,10 @@ public static String join(String[] sa, char c) {
return sb.toString();
}

/** Like assertNotEquals, but fails at the end of the test (during tearDown) */
/** Like assertNotEquals, but fails at the end of the test (during tearDown)
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public void verifyNotEquals(Object expected, Object actual) {
try {
assertNotEquals(expected, actual);
Expand All @@ -371,7 +402,10 @@ public void verifyNotEquals(Object expected, Object actual) {
}
}

/** Like assertNotEquals, but fails at the end of the test (during tearDown) */
/** Like assertNotEquals, but fails at the end of the test (during tearDown)
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public void verifyNotEquals(boolean expected, boolean actual) {
try {
assertNotEquals(Boolean.valueOf(expected), Boolean.valueOf(actual));
Expand All @@ -380,7 +414,10 @@ public void verifyNotEquals(boolean expected, boolean actual) {
}
}

/** Asserts that two objects are not the same (compares using .equals()) */
/** Asserts that two objects are not the same (compares using .equals())
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public static void assertNotEquals(Object expected, Object actual) {
if (expected == null) {
assertFalse("did not expect null to be null", actual == null);
Expand Down Expand Up @@ -409,12 +446,17 @@ static public void assertFalse(boolean condition) {
assertTrue(null, !condition);
}

/** Asserts that two booleans are not the same */
/** Asserts that two booleans are not the same
* @param actual the actual object expected
* @param expected object that you want to compare to actual
*/
public static void assertNotEquals(boolean expected, boolean actual) {
assertNotEquals(Boolean.valueOf(expected), Boolean.valueOf(actual));
}

/** Sleeps for the specified number of milliseconds */
/** Sleeps for the specified number of milliseconds
* @param millisecs number of
*/
public void pause(int millisecs) {
try {
Thread.sleep(millisecs);
Expand All @@ -438,7 +480,9 @@ public void clearVerificationErrors() {
verificationErrors = new StringBuffer();
}

/** checks for verification errors and stops the browser */
/** checks for verification errors and stops the browser
* @throws Exception actually, just AssertionError, but someone was lazy?
*/
public void tearDown() throws Exception {
try {
checkForVerificationErrors();
Expand Down
Loading

0 comments on commit 9888ad4

Please sign in to comment.