|
|
@ -50,15 +50,20 @@ class StartupActivityLogTest {
|
|
|
|
@Test // we test start and stop individually due to the clear-on-stop behavior.
|
|
|
|
@Test // we test start and stop individually due to the clear-on-stop behavior.
|
|
|
|
fun `WHEN app observer start is called THEN it is added directly to the log`() {
|
|
|
|
fun `WHEN app observer start is called THEN it is added directly to the log`() {
|
|
|
|
assertTrue(log.log.isEmpty())
|
|
|
|
assertTrue(log.log.isEmpty())
|
|
|
|
val expected = mutableListOf<LogEntry>()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appObserver.onStart(mockk())
|
|
|
|
appObserver.onStart(mockk())
|
|
|
|
expected.add(LogEntry.AppStarted)
|
|
|
|
assertEquals(listOf(LogEntry.AppStarted), log.log)
|
|
|
|
assertEquals(expected, log.log)
|
|
|
|
|
|
|
|
|
|
|
|
appObserver.onStart(mockk())
|
|
|
|
|
|
|
|
assertEquals(listOf(LogEntry.AppStarted, LogEntry.AppStarted), log.log)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test // we test start and stop individually due to the clear-on-stop behavior.
|
|
|
|
|
|
|
|
fun `WHEN app observer stop is called THEN it is added directly to the log`() {
|
|
|
|
|
|
|
|
assertTrue(log.log.isEmpty())
|
|
|
|
|
|
|
|
|
|
|
|
appObserver.onStop(mockk())
|
|
|
|
appObserver.onStop(mockk())
|
|
|
|
expected.add(LogEntry.AppStopped)
|
|
|
|
assertEquals(listOf(LogEntry.AppStopped), log.log)
|
|
|
|
assertEquals(expected, log.log)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -81,6 +86,19 @@ class StartupActivityLogTest {
|
|
|
|
assertEquals(expected, log.log)
|
|
|
|
assertEquals(expected, log.log)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
fun `WHEN app STOPPED is called THEN the log is emptied expect for the stop event`() {
|
|
|
|
|
|
|
|
assertTrue(log.log.isEmpty())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
activityCallbacks.onActivityCreated(mockk(), null)
|
|
|
|
|
|
|
|
activityCallbacks.onActivityStarted(mockk())
|
|
|
|
|
|
|
|
appObserver.onStart(mockk())
|
|
|
|
|
|
|
|
assertEquals(3, log.log.size)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appObserver.onStop(mockk())
|
|
|
|
|
|
|
|
assertEquals(listOf(LogEntry.AppStopped), log.log)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
fun `GIVEN debug log level WHEN logEntries is called THEN there is no logcat call`() {
|
|
|
|
fun `GIVEN debug log level WHEN logEntries is called THEN there is no logcat call`() {
|
|
|
|
log.logEntries(logger, Priority.DEBUG)
|
|
|
|
log.logEntries(logger, Priority.DEBUG)
|
|
|
|