// Path: src/cn/com/jautoitx/TitleBuilder.java
// public static abstract class By {
// 	private final String property;
// 	private final String value;
// 
// 	public By(final String property) {
// 		this.property = property;
// 		this.value = null;
// 	}
// 
// 	public By(final String property, final String value) {
// 		this.property = property;
// 		this.value = StringUtils.defaultString(value);
// 	}
// 
// 	/**
// 	 * @param title
// 	 *            Window title.
// 	 * @return a By which locates window by the window title.
// 	 */
// 	public static By title(String title) {
// 		return new ByTitle(title);
// 	}
// 
// 	/**
// 	 * @param className
// 	 *            The internal window classname.
// 	 * @return a By which locates window by the internal window classname.
// 	 */
// 	public static By className(String className) {
// 		return new ByClass(className);
// 	}
// 
// 	/**
// 	 * @param regexpTitle
// 	 *            Window title using a regular expression.
// 	 * @return a By which locates window by the window title using a regular
// 	 *         expression.
// 	 */
// 	public static By regexpTitle(String regexpTitle) {
// 		return new ByRegexpTitle(regexpTitle);
// 	}
// 
// 	/**
// 	 * @param regexpClassName
// 	 *            Window classname using a regular expression.
// 	 * @return a By which locates window by the window classname using a
// 	 *         regular expression.
// 	 */
// 	public static By regexpClassName(String regexpClassName) {
// 		return new ByRegexpClass(regexpClassName);
// 	}
// 
// 	/**
// 	 * @return a By which locates window used in a previous AutoIt command.
// 	 */
// 	public static By lastWindow() {
// 		return new ByLast();
// 	}
// 
// 	/**
// 	 * @return a By which locates currently active window.
// 	 */
// 	public static By activeWindow() {
// 		return new ByActive();
// 	}
// 
// 	/**
// 	 * All parameters are optional.
// 	 * 
// 	 * @param x
// 	 *            Optional, the X coordinate of the window.
// 	 * @param y
// 	 *            Optional, the Y coordinate of the window.
// 	 * @param width
// 	 *            Optional, the width of the window.
// 	 * @param height
// 	 *            Optional, the height of the window.
// 	 * @return a By which locates window by the position and size of a
// 	 *         window.
// 	 */
// 	public static By bounds(Integer x, Integer y, Integer width,
// 			Integer height) {
// 		return new ByBounds(x, y, width, height);
// 	}
// 
// 	/**
// 	 * All parameters are optional.
// 	 * 
// 	 * @param x
// 	 *            Optional, the X coordinate of the window.
// 	 * @param y
// 	 *            Optional, the Y coordinate of the window.
// 	 * @return a By which locates window by the position of a window.
// 	 */
// 	public static By position(Integer x, Integer y) {
// 		return bounds(x, y, null, null);
// 	}
// 
// 	/**
// 	 * All parameters are optional.
// 	 * 
// 	 * @param width
// 	 *            Optional, the width of the window.
// 	 * @param height
// 	 *            Optional, the height of the window.
// 	 * @return a By which locates window by the size of a window.
// 	 */
// 	public static By size(Integer width, Integer height) {
// 		return bounds(null, null, width, height);
// 	}
// 
// 	/**
// 	 * @param instance
// 	 *            The 1-based instance when all given properties match.
// 	 * @return a By which locates window by the instance when all given
// 	 *         properties match.
// 	 */
// 	public static By instance(int instance) {
// 		return new ByInstance(instance);
// 	}
// 
// 	/**
// 	 * @param handle
// 	 *            The handle address as returned by a method like
// 	 *            Win.getHandle.
// 	 * @return a By which locates window by the handle address as returned
// 	 *         by a method like Win.getHandle.
// 	 */
// 	public static By handle(String handle) {
// 		return new ByHandle(handle);
// 	}
// 
// 	/**
// 	 * @param hWnd
// 	 *            The handle address as returned by a method like
// 	 *            Win.getHandle_.
// 	 * @return a By which locates window by the handle address as returned
// 	 *         by a method like Win.getHandle.
// 	 */
// 	public static By handle(HWND hWnd) {
// 		return new ByHandle(hWnd);
// 	}
// 
// 	public String toAdvancedTitle() {
// 		StringBuilder advancedTitle = new StringBuilder();
// 		advancedTitle.append(property);
// 		if (value != null) {
// 			advancedTitle.append(':');
// 			for (int i = 0; i < value.length(); i++) {
// 				char ch = value.charAt(i);
// 				advancedTitle.append(ch);
// 				// Note: if a Value must contain a ";" it must be doubled.
// 				if (ch == ';') {
// 					advancedTitle.append(';');
// 				}
// 			}
// 		}
// 		return advancedTitle.toString();
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "By." + property + ": " + value;
// 	}
// }


import org.junit.Assert;
import org.junit.Test;
import cn.com.jautoitx.TitleBuilder.By;

package cn.com.jautoitx;



public class TitleBuilderTest extends BaseTest {
	@Test
	public void by() {
		Assert.assertEquals("[]", TitleBuilder.by());

		// by title

// Path: src/cn/com/jautoitx/TitleBuilder.java
// public static abstract class By {
// 	private final String property;
// 	private final String value;
// 
// 	public By(final String property) {
// 		this.property = property;
// 		this.value = null;
// 	}
// 
// 	public By(final String property, final String value) {
// 		this.property = property;
// 		this.value = StringUtils.defaultString(value);
// 	}
// 
// 	/**
// 	 * @param title
// 	 *            Window title.
// 	 * @return a By which locates window by the window title.
// 	 */
// 	public static By title(String title) {
// 		return new ByTitle(title);
// 	}
// 
// 	/**
// 	 * @param className
// 	 *            The internal window classname.
// 	 * @return a By which locates window by the internal window classname.
// 	 */
// 	public static By className(String className) {
// 		return new ByClass(className);
// 	}
// 
// 	/**
// 	 * @param regexpTitle
// 	 *            Window title using a regular expression.
// 	 * @return a By which locates window by the window title using a regular
// 	 *         expression.
// 	 */
// 	public static By regexpTitle(String regexpTitle) {
// 		return new ByRegexpTitle(regexpTitle);
// 	}
// 
// 	/**
// 	 * @param regexpClassName
// 	 *            Window classname using a regular expression.
// 	 * @return a By which locates window by the window classname using a
// 	 *         regular expression.
// 	 */
// 	public static By regexpClassName(String regexpClassName) {
// 		return new ByRegexpClass(regexpClassName);
// 	}
// 
// 	/**
// 	 * @return a By which locates window used in a previous AutoIt command.
// 	 */
// 	public static By lastWindow() {
// 		return new ByLast();
// 	}
// 
// 	/**
// 	 * @return a By which locates currently active window.
// 	 */
// 	public static By activeWindow() {
// 		return new ByActive();
// 	}
// 
// 	/**
// 	 * All parameters are optional.
// 	 * 
// 	 * @param x
// 	 *            Optional, the X coordinate of the window.
// 	 * @param y
// 	 *            Optional, the Y coordinate of the window.
// 	 * @param width
// 	 *            Optional, the width of the window.
// 	 * @param height
// 	 *            Optional, the height of the window.
// 	 * @return a By which locates window by the position and size of a
// 	 *         window.
// 	 */
// 	public static By bounds(Integer x, Integer y, Integer width,
// 			Integer height) {
// 		return new ByBounds(x, y, width, height);
// 	}
// 
// 	/**
// 	 * All parameters are optional.
// 	 * 
// 	 * @param x
// 	 *            Optional, the X coordinate of the window.
// 	 * @param y
// 	 *            Optional, the Y coordinate of the window.
// 	 * @return a By which locates window by the position of a window.
// 	 */
// 	public static By position(Integer x, Integer y) {
// 		return bounds(x, y, null, null);
// 	}
// 
// 	/**
// 	 * All parameters are optional.
// 	 * 
// 	 * @param width
// 	 *            Optional, the width of the window.
// 	 * @param height
// 	 *            Optional, the height of the window.
// 	 * @return a By which locates window by the size of a window.
// 	 */
// 	public static By size(Integer width, Integer height) {
// 		return bounds(null, null, width, height);
// 	}
// 
// 	/**
// 	 * @param instance
// 	 *            The 1-based instance when all given properties match.
// 	 * @return a By which locates window by the instance when all given
// 	 *         properties match.
// 	 */
// 	public static By instance(int instance) {
// 		return new ByInstance(instance);
// 	}
// 
// 	/**
// 	 * @param handle
// 	 *            The handle address as returned by a method like
// 	 *            Win.getHandle.
// 	 * @return a By which locates window by the handle address as returned
// 	 *         by a method like Win.getHandle.
// 	 */
// 	public static By handle(String handle) {
// 		return new ByHandle(handle);
// 	}
// 
// 	/**
// 	 * @param hWnd
// 	 *            The handle address as returned by a method like
// 	 *            Win.getHandle_.
// 	 * @return a By which locates window by the handle address as returned
// 	 *         by a method like Win.getHandle.
// 	 */
// 	public static By handle(HWND hWnd) {
// 		return new ByHandle(hWnd);
// 	}
// 
// 	public String toAdvancedTitle() {
// 		StringBuilder advancedTitle = new StringBuilder();
// 		advancedTitle.append(property);
// 		if (value != null) {
// 			advancedTitle.append(':');
// 			for (int i = 0; i < value.length(); i++) {
// 				char ch = value.charAt(i);
// 				advancedTitle.append(ch);
// 				// Note: if a Value must contain a ";" it must be doubled.
// 				if (ch == ';') {
// 					advancedTitle.append(';');
// 				}
// 			}
// 		}
// 		return advancedTitle.toString();
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "By." + property + ": " + value;
// 	}
// }


// Path: test/cn/com/jautoitx/TitleBuilderTest.java
import org.junit.Assert;
import org.junit.Test;
import cn.com.jautoitx.TitleBuilder.By;

package cn.com.jautoitx;



public class TitleBuilderTest extends BaseTest {
	@Test
	public void by() {
		Assert.assertEquals("[]", TitleBuilder.by());

		// by title

		Assert.assertEquals("[TITLE:]", TitleBuilder.by(By.title(null)));
