13
13
import static org .mockito .Mockito .mock ;
14
14
15
15
public class SauceSessionTest {
16
- private SauceSession session ;
16
+ private SauceOptions sauceOptions ;
17
+ private SauceSession sauceSession ;
17
18
18
- @ Test
19
- public void defaultConstructor_called_returnsObject ()
20
- {
21
- session = new SauceSession ();
22
- assertNotNull (session );
23
- }
24
19
@ Test
25
20
public void getDriver_called_returnsWebDriver () {
26
21
WebDriver stubDriver = mock (WebDriver .class );
@@ -30,32 +25,32 @@ public void getDriver_called_returnsWebDriver() {
30
25
@ Test
31
26
public void noSauceOptionsSet_whenCreated_defaultChrome ()
32
27
{
33
- SauceSession session = new SauceSession ();
34
- String actualBrowser = session .getBrowser ();
28
+ sauceSession = new SauceSession ();
29
+ String actualBrowser = sauceSession .getBrowser ();
35
30
assertThat (actualBrowser , IsEqualIgnoringCase .equalToIgnoringCase ("Chrome" ));
36
31
}
37
32
@ Test
38
33
public void noSauceOptionsSet_instantiated_defaultOsWindows10 () throws MalformedURLException {
39
34
RemoteDriverInterface stubRemoteDriver = mock (RemoteDriverInterface .class );
40
- SauceSession session = new SauceSession (stubRemoteDriver );
41
- session .start ();
42
- String actualOperatingSystem = session .getOs ();
35
+ sauceSession = new SauceSession (stubRemoteDriver );
36
+ sauceSession .start ();
37
+ String actualOperatingSystem = sauceSession .getOs ();
43
38
assertThat (actualOperatingSystem , IsEqualIgnoringCase .equalToIgnoringCase ("win10" ));
44
39
}
45
40
@ Test
46
41
public void noSauceOptionsSet_instantiated_latestBrowserVersion ()
47
42
{
48
- SauceSession session = new SauceSession ();
49
- String actualOperatingSystem = session .getBrowserVersion ();
43
+ sauceSession = new SauceSession ();
44
+ String actualOperatingSystem = sauceSession .getBrowserVersion ();
50
45
assertThat (actualOperatingSystem , IsEqualIgnoringCase .equalToIgnoringCase ("latest" ));
51
46
}
52
47
@ Test
53
48
public void sauceOptionsSet_withOnlyWindows10_returnsWindows10 () throws MalformedURLException {
54
- SauceOptions options = new SauceOptions ();
55
- options .setOs ("Windows 10" );
49
+ sauceOptions = new SauceOptions ();
50
+ sauceOptions .setOs ("Windows 10" );
56
51
57
52
RemoteDriverInterface stubRemoteDriver = mock (RemoteDriverInterface .class );
58
- SauceSession session = new SauceSession (options , stubRemoteDriver );
53
+ SauceSession session = new SauceSession (sauceOptions , stubRemoteDriver );
59
54
session .start ();
60
55
String actualOperatingSystem = session .getOs ();
61
56
assertThat (actualOperatingSystem , IsEqualIgnoringCase .equalToIgnoringCase ("win10" ));
0 commit comments