Skip to content

Commit

Permalink
test: add application test
Browse files Browse the repository at this point in the history
  • Loading branch information
mcatta committed Oct 16, 2023
1 parent 12fdc9a commit 034100b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2023 Marco Cattaneo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dev.marcocattaneo.sleep.di

import androidx.test.ext.junit.rules.ActivityScenarioRule
import dev.marcocattaneo.sleep.MainActivity
import org.junit.Assert.*
import org.junit.Rule
import org.junit.Test


internal class SleepifyApplicationTest {

@get:Rule
var rule: ActivityScenarioRule<MainActivity> = ActivityScenarioRule(MainActivity::class.java)

@Test
fun testOnCreate() {
// Given
val scenario = rule.scenario

// When
scenario.onActivity { activity ->
// then
assertEquals(SleepifyApplication::class.java, activity.application::class.java)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import javax.inject.Inject
class PlayerNotificationService : Service() {

sealed class Action(val key: String) {
object PLAY : Action("dev.marcocattaneo.sleep.PlayerNotificationService.PLAY")
data object PLAY : Action("dev.marcocattaneo.sleep.PlayerNotificationService.PLAY")

object PAUSE : Action("dev.marcocattaneo.sleep.PlayerNotificationService.PAUSE")
data object PAUSE : Action("dev.marcocattaneo.sleep.PlayerNotificationService.PAUSE")

object STOP : Action("dev.marcocattaneo.sleep.PlayerNotificationService.STOP")
data object STOP : Action("dev.marcocattaneo.sleep.PlayerNotificationService.STOP")
}

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package sleep.buildtools.jacoco

object JacocoOptions {
internal object JacocoOptions {
val EXCLUDED_FILES = listOf(
// data binding
"android/databinding/**/*.class",
Expand Down

0 comments on commit 034100b

Please sign in to comment.