package me.alb_i986.selenium.tinafw.domain;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.safari.SafariDriver;

public enum SupportedBrowser {

	CHROME(ChromeDriver.class, DesiredCapabilities.chrome()),
	FIREFOX(FirefoxDriver.class, DesiredCapabilities.firefox()),
	SAFARI(SafariDriver.class, DesiredCapabilities.safari()),
	IE(InternetExplorerDriver.class, DesiredCapabilities.internetExplorer()),
	HTML_UNIT(HtmlUnitDriver.class, DesiredCapabilities.htmlUnit()),
	;

	private DesiredCapabilities capabilities;
	private Class<?> clazz;

	private SupportedBrowser(Class<?> clazz, DesiredCapabilities capabilities) {
		this.clazz = clazz;
		this.capabilities = capabilities;
	}
	
	/**
	 * @see Class#getName()
	 */
	public String toClassName() {
		return clazz.getName();
	}

	/**
	 * @return the concrete WebDriver class corresponding to this enum
	 * @throws ClassNotFoundException
	 */
	@SuppressWarnings("unchecked")
	public Class<WebDriver> toClass() throws ClassNotFoundException {
		return (Class<WebDriver>) Class.forName(toClassName());
	}

	public DesiredCapabilities toCapabilities() {
		return this.capabilities;
	}

	/**
	 * @return the lower cased name of the enum constant
	 */
	@Override
	public String toString() {
		return super.toString().toLowerCase();
	}
}
@@ -384,16 +384,355 @@
 river;%0A%0A
+/**%0A * A browser supported by %3Ca href=%22http://seleniumhq.org%22%3ESelenium%3C/a%3E.%0A * %3Cp%3E%0A * This enum provides a couple of useful conversion methods:%0A * %3Cul%3E%0A * %3Cli%3E%7B@link #toClass()%7D, to get the corresponding concrete %7B@link WebDriver%7D class,%0A * %3Cli%3E%7B@link #toCapabilities()%7D, to get the corresponding %7B@link DesiredCapabilities%7D.%0A * %3C/ul%3E%0A */%0A
 public e
@@ -1139,23 +1139,58 @@
  Class%3C?
-%3E clazz
+ extends WebDriver%3E concreteWebDriverClass
 ;%0A%0A%09priv
@@ -1217,16 +1217,34 @@
 (Class%3C?
+ extends WebDriver
 %3E clazz,
@@ -1288,20 +1288,37 @@
 %09%09this.c
-lazz
+oncreteWebDriverClass
  = clazz
@@ -1364,104 +1364,8 @@
 %7D%0A%09%0A
-%09/**%0A%09 * @see Class#getName()%0A%09 */%0A%09public String toClassName() %7B%0A%09%09return clazz.getName();%0A%09%7D%0A%0A
 %09/**
@@ -1614,23 +1614,42 @@
 forName(
-to
+concreteWebDriver
 Class
+.get
 Name());
@@ -1775,17 +1775,18 @@
 me of th
-e
+is
  enum co

clean up SupportedBrowser: add javadocs, rename variables