-
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 #155 from SCCapstone/esambranch
Unit Testing #75
- Loading branch information
Showing
5 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
app/src/androidTest/java/com/symphony/mrfit/ui/CalendarActivityTest.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,18 @@ | ||
package com.symphony.mrfit.ui | ||
|
||
import org.junit.Assert.* | ||
|
||
import org.junit.Test | ||
|
||
class CalendarActivityTest { | ||
//behavioral | ||
@Test | ||
fun onCreate() { | ||
} | ||
@Test | ||
fun onStart() { | ||
} | ||
@Test | ||
fun onSupportNavigateUp() { | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
app/src/androidTest/java/com/symphony/mrfit/ui/CurrentWorkoutActivityTest.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,56 @@ | ||
package com.symphony.mrfit.ui | ||
import android.content.ComponentName | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.test.core.app.ActivityScenario | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.rule.ActivityTestRule | ||
import org.junit.After | ||
import org.junit.Assert.* | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.Assert.assertEquals | ||
|
||
|
||
|
||
|
||
@RunWith(AndroidJUnit4::class) | ||
class CurrentWorkoutActivityTest { | ||
//behavioral | ||
@Test | ||
fun onCreate() { | ||
|
||
} | ||
//behavioral | ||
@Test | ||
fun onStart() { | ||
|
||
} | ||
@Test | ||
fun gotoHome() { | ||
// Start the activity | ||
val context = ApplicationProvider.getApplicationContext<Context>() | ||
val intent = Intent(context, HomeActivity::class.java) | ||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) | ||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) | ||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
|
||
val expectedFlags = (Intent.FLAG_ACTIVITY_CLEAR_TOP or | ||
Intent.FLAG_ACTIVITY_CLEAR_TASK or | ||
Intent.FLAG_ACTIVITY_NEW_TASK) | ||
|
||
assertEquals(expectedFlags, intent.flags) | ||
assertEquals(context.packageName, intent.component?.packageName) | ||
assertEquals(HomeActivity::class.java.name, intent.component?.className) | ||
} | ||
//behavioral | ||
@Test | ||
fun onSupportNavigateUp() { | ||
|
||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app/src/androidTest/java/com/symphony/mrfit/ui/CustomExercisesActivityTest.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,27 @@ | ||
package com.symphony.mrfit.ui | ||
|
||
import androidx.test.core.app.ApplicationProvider | ||
import com.symphony.mrfit.data.exercise.ExerciseViewModel | ||
import com.symphony.mrfit.data.model.Exercise | ||
import org.junit.Assert.* | ||
import org.junit.Before | ||
|
||
import org.junit.Test | ||
|
||
class CustomExercisesActivityTest { | ||
//behavioral | ||
//TODO | ||
@Test | ||
fun onCreate() { | ||
} | ||
@Test | ||
fun onStart() { | ||
} | ||
@Test | ||
fun onSupportNavigateUp() { | ||
} | ||
@Test | ||
fun deleteExercise(){ | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
app/src/androidTest/java/com/symphony/mrfit/ui/GoalsActivityTest.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,24 @@ | ||
package com.symphony.mrfit.ui | ||
|
||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import com.symphony.mrfit.R | ||
|
||
|
||
|
||
|
||
class GoalsActivityTest { | ||
@get:Rule | ||
var activityScenarioRule = activityScenarioRule<GoalsActivity>() | ||
|
||
//TODO | ||
@Test | ||
fun checkActivityVisibility() { | ||
} | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
app/src/androidTest/java/com/symphony/mrfit/ui/HelperTest.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,31 @@ | ||
package com.symphony.mrfit.ui | ||
|
||
import android.app.Activity | ||
import android.view.View | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.ViewMatchers.* | ||
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation | ||
import com.google.android.material.snackbar.Snackbar | ||
import org.hamcrest.CoreMatchers.* | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Before | ||
import org.junit.Test | ||
import java.util.* | ||
|
||
|
||
class HelperTest{ | ||
private lateinit var activity: Activity | ||
|
||
//test functionality of calendar method | ||
@Test | ||
fun toCalendarconvertsDatetoCalendar() { | ||
val date = Date() | ||
val cal = Helper.toCalendar(date) | ||
assertThat(cal.get(Calendar.YEAR), `is`(Calendar.getInstance().get(Calendar.YEAR))) | ||
assertThat(cal.get(Calendar.MONTH), `is`(Calendar.getInstance().get(Calendar.MONTH))) | ||
assertThat(cal.get(Calendar.DAY_OF_MONTH), `is`(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)) | ||
) | ||
} | ||
} |