diff --git a/android/kotlin/app/src/androidTest/java/ie/equalit/ouinet_examples/android_kotlin/ExampleInstrumentedTest.kt b/android/kotlin/app/src/androidTest/java/ie/equalit/ouinet_examples/android_kotlin/OuinetInstrumentedTest.kt similarity index 76% rename from android/kotlin/app/src/androidTest/java/ie/equalit/ouinet_examples/android_kotlin/ExampleInstrumentedTest.kt rename to android/kotlin/app/src/androidTest/java/ie/equalit/ouinet_examples/android_kotlin/OuinetInstrumentedTest.kt index 0edbc29..d5ce84b 100644 --- a/android/kotlin/app/src/androidTest/java/ie/equalit/ouinet_examples/android_kotlin/ExampleInstrumentedTest.kt +++ b/android/kotlin/app/src/androidTest/java/ie/equalit/ouinet_examples/android_kotlin/OuinetInstrumentedTest.kt @@ -17,7 +17,7 @@ import org.junit.Assert.* * See [testing documentation](http://d.android.com/tools/testing). */ @RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { +class OuinetInstrumentedTest { @Test fun useAppContext() { // Context of the app under test. @@ -36,16 +36,24 @@ class ExampleInstrumentedTest { var ouinet = Ouinet(appContext, config) for (i in 1..5) { - ouinet.start() ouinet.start() Thread.sleep(1000); - assertEquals("Starting", ouinet.state.toString()); + assertTrue(ouinet.state.toString().startsWith("Start")) - ouinet.stop() ouinet.stop() assertEquals("Stopped", ouinet.state.toString()); } + for (i in 1..3) { + Thread.sleep(100); + ouinet.stop() + assertEquals("Stopped", ouinet.state.toString()); + } + + ouinet.start() + Thread.sleep(1000); + assertTrue(ouinet.state.toString().startsWith("Start")) ouinet.stop() + assertEquals("Stopped", ouinet.state.toString()); } }