-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1144e75
commit 2cfd827
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/test/java/ru/colibri/ui/settings/server/AppiumServerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package ru.colibri.ui.settings.server; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.MockitoAnnotations; | ||
import org.mockito.junit.MockitoJUnitRunner; | ||
|
||
import static org.mockito.Mockito.when; | ||
|
||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class AppiumServerTest { | ||
|
||
@InjectMocks | ||
AppiumServer server; | ||
|
||
@Mock | ||
AbstractServerConfig config; | ||
|
||
@Before | ||
public void setUp() { | ||
MockitoAnnotations.initMocks(this); | ||
} | ||
|
||
@Test | ||
public void startAndStopServer() throws Exception { | ||
when(config.getHost()).thenReturn("0.0.0.0"); | ||
when(config.getPort()).thenReturn("4723"); | ||
server.startServer(); | ||
server.stopServer(); | ||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void startServerWithWrongHost() throws Exception { | ||
when(config.getHost()).thenReturn("1.2.3.4.5.6.7"); | ||
when(config.getPort()).thenReturn("4723"); | ||
server.startServer(); | ||
|
||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void startServerWithWrongPort() throws Exception { | ||
when(config.getHost()).thenReturn("0.0.0.0"); | ||
when(config.getPort()).thenReturn("-4723"); | ||
server.startServer(); | ||
|
||
} | ||
|
||
} |