Build coverage report (#3)

Add first unit test & code coverage config
This commit is contained in:
Mikołaj Pich
2017-07-20 17:37:55 +02:00
committed by GitHub
parent 9d98173b04
commit 4b425f9b39
10 changed files with 68 additions and 44 deletions

View File

@ -1,17 +0,0 @@
package io.github.wulkanowy;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

View File

@ -0,0 +1,28 @@
package io.github.wulkanowy.activity.main;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.Test;
import static org.junit.Assert.*;
public class CheckPassTest {
@Test
public void testFailureLogin() throws Exception {
String html = "<div class='ErrorMessage center'>Zła nazwa użytkownika lub hasło</div>";
Document doc = Jsoup.parse(html);
CheckPass obj = new CheckPass(doc);
assertFalse(obj.isLogged());
}
@Test
public void testSuccessfulLogin() throws Exception {
String html = "<title>Working...</title>";
Document doc = Jsoup.parse(html);
CheckPass check = new CheckPass(doc);
assertTrue(check.isLogged());
}
}