This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #268 from MaximeZmt/maximezmt/fireIntentRefactor
some refactor of intent fireing
- Loading branch information
Showing
20 changed files
with
222 additions
and
111 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
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
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
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
51 changes: 51 additions & 0 deletions
51
app/src/androidTest/java/ch/sdp/vibester/helper/IntentSwitcherTest.kt
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,51 @@ | ||
package ch.sdp.vibester.helper | ||
|
||
import android.content.Intent | ||
import androidx.test.core.app.ActivityScenario | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.espresso.intent.Intents | ||
import androidx.test.espresso.intent.matcher.IntentMatchers | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import ch.sdp.vibester.activity.MainActivity | ||
import dagger.hilt.android.testing.HiltAndroidRule | ||
import dagger.hilt.android.testing.HiltAndroidTest | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import java.io.Serializable | ||
|
||
|
||
@HiltAndroidTest | ||
@RunWith(AndroidJUnit4::class) | ||
class IntentSwitcherTest { | ||
@get:Rule | ||
var hiltRule = HiltAndroidRule(this) | ||
|
||
|
||
@Before | ||
fun setUp() { | ||
hiltRule.inject() | ||
Intents.init() | ||
} | ||
|
||
@After | ||
fun clean() { | ||
Intents.release() | ||
} | ||
|
||
@Test | ||
fun checkIntentOnPlay() { | ||
val intent = Intent(ApplicationProvider.getApplicationContext(), MainActivity::class.java) | ||
val scn: ActivityScenario<MainActivity> = ActivityScenario.launch(intent) | ||
|
||
val testMap: HashMap<String, Serializable> = HashMap() | ||
testMap.put("test", true) | ||
|
||
IntentSwitcher.switch(ApplicationProvider.getApplicationContext(), MainActivity::class.java, testMap) | ||
Intents.intended(IntentMatchers.hasComponent(MainActivity::class.java.name)) | ||
Intents.intended(IntentMatchers.hasExtra("test", true)) | ||
} | ||
|
||
} |
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
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
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
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
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
Oops, something went wrong.