Skip to content

Commit

Permalink
suppress warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
crocsandcoffee committed Jul 6, 2023
1 parent eff6703 commit a3e3e28
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ internal class WorkerCompositionIntegrationTest {
}
}
val workflow = Workflow.stateless<Boolean, Nothing, Unit> { props ->
// Suppress runningWorker usage because we want to make sure this
// test still properly tests usage with LifecycleWorker
@Suppress("DEPRECATION")
if (props) runningWorker(worker)
}

Expand All @@ -73,7 +76,12 @@ internal class WorkerCompositionIntegrationTest {
stops++
}
}
val workflow = Workflow.stateless<Unit, Nothing, Unit> { runningWorker(worker) }
val workflow = Workflow.stateless<Unit, Nothing, Unit> {
// Suppress runningWorker usage because we want to make sure this
// test still properly tests usage with LifecycleWorker
@Suppress("DEPRECATION")
runningWorker(worker)
}

workflow.launchForTestingFromStartWith {
assertEquals(1, starts)
Expand Down Expand Up @@ -102,6 +110,9 @@ internal class WorkerCompositionIntegrationTest {
}
}
val workflow = Workflow.stateless<Boolean, Nothing, Unit> { props ->
// Suppress runningWorker usage because we want to make sure this
// test still properly tests usage with LifecycleWorker
@Suppress("DEPRECATION")
if (props) runningWorker(worker)
}

Expand Down Expand Up @@ -212,6 +223,9 @@ internal class WorkerCompositionIntegrationTest {
@Suppress("UNCHECKED_CAST")
val worker = Worker.from { Unit } as Worker<Nothing>
val workflow = Workflow.stateless<Unit, Unit, Unit> {
// Suppress runningWorker usage because we want to make sure the deprecated
// method still throws an exception as expected
@Suppress("DEPRECATION")
runningWorker(worker)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ internal class RealRenderTesterTest {
}

val workflow = Workflow.stateless<Unit, Nothing, Unit> {
// Suppress runningWorker usage because we want to make sure the internal exception
// is not thrown when we don't expect an output
@Suppress("DEPRECATION")
runningWorker(worker)
}
val tester = workflow.testRender(Unit)
Expand Down Expand Up @@ -584,6 +587,9 @@ internal class RealRenderTesterTest {
val worker = MySpecialWorker()

val workflow = Workflow.stateless<Unit, Nothing, Unit> {
// Suppress runningWorker usage because we are testing/validating the internal
// exception that is thrown
@Suppress("DEPRECATION")
runningWorker(worker)
}
val tester = workflow.testRender(Unit).requireExplicitWorkerExpectations()
Expand Down Expand Up @@ -626,6 +632,9 @@ internal class RealRenderTesterTest {
}

val workflow = Workflow.stateless<Unit, Nothing, Unit> {
// Suppress runningWorker usage because we want to make sure the internal exception
// is not thrown when we don't expect an output, even with a unique key specified
@Suppress("DEPRECATION")
runningWorker(worker, key = "key")
}
val tester = workflow.testRender(Unit)
Expand All @@ -641,6 +650,9 @@ internal class RealRenderTesterTest {
}

val workflow = Workflow.stateless<Unit, Nothing, Unit> {
// Suppress runningWorker usage because we are
// testing/validating the internal exception that is thrown
@Suppress("DEPRECATION")
runningWorker(worker, key = "key")
}
val tester = workflow.testRender(Unit)
Expand All @@ -662,6 +674,9 @@ internal class RealRenderTesterTest {
}

val workflow = Workflow.stateless<Unit, Nothing, Unit> {
// Suppress runningWorker usage because we are
// expecting an exception to be thrown with mismatched keys
@Suppress("DEPRECATION")
runningWorker(worker, key = "key")
}
val tester = workflow.testRender(Unit)
Expand All @@ -687,6 +702,7 @@ internal class RealRenderTesterTest {

val worker = EmptyWorker()
val workflow = Workflow.stateless<Unit, Nothing, Unit> {
@Suppress("DEPRECATION")
runningWorker(worker)
}
val tester = workflow.testRender(Unit)
Expand All @@ -711,6 +727,9 @@ internal class RealRenderTesterTest {
val stringWorker: Worker<String> = emptyFlow<String>().asWorker()

val workflow = Workflow.stateless<Unit, Nothing, Unit> {
// Suppress usage as we are testing a comparisons of unique workers
// even though they have the same key.
@Suppress("DEPRECATION")
runningWorker(lifecycleWorker)
runningWorker(stringWorker) { noAction() }
}
Expand All @@ -722,6 +741,9 @@ internal class RealRenderTesterTest {
// No exception, no bug.
}

// Suppress runningWorker in this test as we are testing the
// uniqueness of workers using similar objects as keys
@Suppress("DEPRECATION")
@Test fun `runningWorker distinguishes between specific Nothing workers`() {
val workerA = object : LifecycleWorker() {}
val workerB = object : LifecycleWorker() {}
Expand Down

0 comments on commit a3e3e28

Please sign in to comment.