Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Commit b1dd4df

Browse files
refactoring of sauceSessionTest
1 parent 4c2dfa1 commit b1dd4df

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

common/src/test/java/com/saucelabs/common/unit/SauceSessionTest.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@
1313
import static org.mockito.Mockito.mock;
1414

1515
public class SauceSessionTest {
16-
private SauceSession session;
16+
private SauceOptions sauceOptions;
17+
private SauceSession sauceSession;
1718

18-
@Test
19-
public void defaultConstructor_called_returnsObject()
20-
{
21-
session = new SauceSession();
22-
assertNotNull(session);
23-
}
2419
@Test
2520
public void getDriver_called_returnsWebDriver() {
2621
WebDriver stubDriver = mock(WebDriver.class);
@@ -30,32 +25,32 @@ public void getDriver_called_returnsWebDriver() {
3025
@Test
3126
public void noSauceOptionsSet_whenCreated_defaultChrome()
3227
{
33-
SauceSession session = new SauceSession();
34-
String actualBrowser = session.getBrowser();
28+
sauceSession = new SauceSession();
29+
String actualBrowser = sauceSession.getBrowser();
3530
assertThat(actualBrowser, IsEqualIgnoringCase.equalToIgnoringCase("Chrome"));
3631
}
3732
@Test
3833
public void noSauceOptionsSet_instantiated_defaultOsWindows10() throws MalformedURLException {
3934
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();
4338
assertThat(actualOperatingSystem, IsEqualIgnoringCase.equalToIgnoringCase("win10"));
4439
}
4540
@Test
4641
public void noSauceOptionsSet_instantiated_latestBrowserVersion()
4742
{
48-
SauceSession session = new SauceSession();
49-
String actualOperatingSystem = session.getBrowserVersion();
43+
sauceSession = new SauceSession();
44+
String actualOperatingSystem = sauceSession.getBrowserVersion();
5045
assertThat(actualOperatingSystem, IsEqualIgnoringCase.equalToIgnoringCase("latest"));
5146
}
5247
@Test
5348
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");
5651

5752
RemoteDriverInterface stubRemoteDriver = mock(RemoteDriverInterface.class);
58-
SauceSession session = new SauceSession(options, stubRemoteDriver);
53+
SauceSession session = new SauceSession(sauceOptions, stubRemoteDriver);
5954
session.start();
6055
String actualOperatingSystem = session.getOs();
6156
assertThat(actualOperatingSystem, IsEqualIgnoringCase.equalToIgnoringCase("win10"));

0 commit comments

Comments
 (0)