diff --git a/app/build.gradle b/app/build.gradle index 2a581304..1eba454f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,6 +43,16 @@ dependencies { compile 'com.android.support:cardview-v7:25.4.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'me.dm7.barcodescanner:zxing:1.9.8' + + androidTestCompile 'com.android.support:support-annotations:25.4.0' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' + // Optional -- Hamcrest library + //androidTestCompile 'org.hamcrest:hamcrest-library:1.3' + // Optional -- UI testing with Espresso + //androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' + // Optional -- UI testing with UI Automator + //androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2' } dependencyVerification { diff --git a/app/src/androidTest/java/com/m2049r/xmrwallet/util/HelperTest.java b/app/src/androidTest/java/com/m2049r/xmrwallet/util/HelperTest.java new file mode 100644 index 00000000..b51324de --- /dev/null +++ b/app/src/androidTest/java/com/m2049r/xmrwallet/util/HelperTest.java @@ -0,0 +1,30 @@ +package com.m2049r.xmrwallet.util; + +import android.support.test.runner.AndroidJUnit4; +import android.test.suitebuilder.annotation.SmallTest; + +import com.m2049r.xmrwallet.model.Wallet; + +import junit.framework.Assert; + +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Created by bruno on 14/11/2017. + */ + +@RunWith(AndroidJUnit4.class) +@SmallTest +public class HelperTest { + + /** + * + */ + @Test + public void checkValidAddressExample_1() { + // random generated address by https://xmr.llcoins.net/addresstests.html + String publicAddr = "4GKacjHuTGeReA7PvxPhehDswu3RwpnAqeJV2kdU3MLMNUr4Lt9pxcRiWU2E6BoDReADhCPtHfvNFh1YVNLFoZE5YtaSMc8MSbGGudRftK"; + Assert.assertTrue(Wallet.isAddressValid(publicAddr, false)); + } +} diff --git a/app/src/androidTest/java/com/m2049r/xmrwallet/util/suite/UnitTestSuite.java b/app/src/androidTest/java/com/m2049r/xmrwallet/util/suite/UnitTestSuite.java new file mode 100644 index 00000000..d5adfbd7 --- /dev/null +++ b/app/src/androidTest/java/com/m2049r/xmrwallet/util/suite/UnitTestSuite.java @@ -0,0 +1,15 @@ +package com.m2049r.xmrwallet.util.suite; + +/** + * Created by bruno on 14/11/2017. + */ + +import com.m2049r.xmrwallet.util.HelperTest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +// Runs all unit tests. +@RunWith(Suite.class) +@Suite.SuiteClasses({HelperTest.class}) +public class UnitTestSuite {} \ No newline at end of file