Skip to content

Instantly share code, notes, and snippets.

View Iannnr's full-sized avatar

Ian Roberts Iannnr

  • Vet-AI
  • Gloucestershire
  • 09:07 (UTC +01:00)
View GitHub Profile
val config = Configuration.Builder()
.setWorkerFactory(ExampleWorkerFactory(Repository(api)))
.setExecutor(SynchronousExecutor())
.setMinimumLoggingLevel(Log.DEBUG)
.build()
WorkManagerTestInitHelper.initializeTestWorkManager(context, config)
@RunWith(RobolectricTestRunner::class)
class ExampleWorkerTest {
@Mock
lateinit var api: ApiInterface
lateinit var context: Context
@Before
fun setup() {
val worker = TestListenableWorkerBuilder<ExampleWorker>(context)
.setWorkerFactory(ExampleWorkerFactory(repo))
.setInputData(
workDataOf("data" to false)
)
.build()