package com.googlecode.jmeter.plugins.webdriver.config;

import static org.junit.Assert.*;

import org.junit.Test;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import static org.hamcrest.core.Is.*;
import static org.hamcrest.CoreMatchers.notNullValue;

public class RemoteDesiredCapabilitiesFactoryTest {
	
	@Test
	public void shouldReturnFirefoxDriverWhenFirefoxCapabilityIsPassed() throws Exception {
		DesiredCapabilities capabilities = RemoteDesiredCapabilitiesFactory.build(RemoteCapability.FIREFOX);
		assertThat(capabilities.getCapability(FirefoxDriver.PROFILE), is(notNullValue()));
		assertThat(capabilities.getBrowserName(), is("firefox"));
	}
	
	@Test
	public void shouldReturnChromeDriverWhenChromeCapabilityIsPassed() throws Exception {
		DesiredCapabilities capabilities = RemoteDesiredCapabilitiesFactory.build(RemoteCapability.CHROME);
		assertThat(capabilities.getCapability(ChromeOptions.CAPABILITY), is(notNullValue()));
		assertThat(capabilities.getBrowserName(), is("chrome"));
	}
	
	@Test
	public void shouldReturnInternetExplorerDriverWhenChromeCapabilityIsPassed() throws Exception {
		DesiredCapabilities capabilities = RemoteDesiredCapabilitiesFactory.build(RemoteCapability.INTERNET_EXPLORER);
		assertThat(capabilities.getBrowserName(), is("internet explorer"));
	}
	@Test(expected = IllegalArgumentException.class)
	public void shouldThrowAnExceptionWhenAnInvalidCapabilityIsPassed() throws Exception {
		RemoteDesiredCapabilitiesFactory.build(null);
	}

}

@@ -407,18 +407,17 @@
 yTest %7B%0A
-%09
 %0A
+
 %09@Test%0A%09
@@ -747,34 +747,33 @@
 %22firefox%22));%0A%09%7D%0A
-%09
 %0A
+
 %09@Test%0A%09public v
@@ -1106,10 +1106,9 @@
 %0A%09%7D%0A
-%09
 %0A
+
 %09@Te
@@ -1390,19 +1390,376 @@
 rer%22));%0A
-
 %09%7D%0A
+%0A%09@Test%0A%09public void shouldReturnPhantomJSDriverWhenChromeCapabilityIsPassed() throws Exception %7B%0A%09%09DesiredCapabilities capabilities = RemoteDesiredCapabilitiesFactory.build(RemoteCapability.PHANTOMJS);%0A%09%09assertThat(capabilities.getCapability(ChromeOptions.CAPABILITY), is(notNullValue()));%0A%09%09assertThat(capabilities.getBrowserName(), is(%22phantomjs%22));%0A%09%7D%0A%0A
 %09@Test(e

Add tests to PhantomJS (GhostDriver) capability