Skip to content

Commit

Permalink
add appium server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperJhons committed Oct 30, 2017
1 parent 1144e75 commit 2cfd827
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ jdk:
- oraclejdk8
install: true
before_install:
- npm install -g appium
- test $TRAVIS_PULL_REQUEST = false && openssl aes-256-cbc -K $encrypted_45a1e02b23ba_key
-iv $encrypted_45a1e02b23ba_iv -in gradle.properties.enc -out gradle.properties
-d || true
Expand Down
52 changes: 52 additions & 0 deletions src/test/java/ru/colibri/ui/settings/server/AppiumServerTest.java
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();

}

}

0 comments on commit 2cfd827

Please sign in to comment.