From 8f538c6afd816120377102b637bee43c82fb1ef5 Mon Sep 17 00:00:00 2001 From: Brian Plummer Date: Wed, 22 May 2019 15:53:57 -0400 Subject: [PATCH] fix MoshiSourceParserTest.testSourceParser() by folding in setup method --- .../store3/middleware/moshi/MoshiSourceParserTest.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/middleware-moshi/src/test/java/com/nytimes/android/external/store3/middleware/moshi/MoshiSourceParserTest.kt b/middleware-moshi/src/test/java/com/nytimes/android/external/store3/middleware/moshi/MoshiSourceParserTest.kt index e31355b..b96cdb2 100644 --- a/middleware-moshi/src/test/java/com/nytimes/android/external/store3/middleware/moshi/MoshiSourceParserTest.kt +++ b/middleware-moshi/src/test/java/com/nytimes/android/external/store3/middleware/moshi/MoshiSourceParserTest.kt @@ -3,6 +3,7 @@ package com.nytimes.android.external.store3.middleware.moshi import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.whenever import com.nytimes.android.external.store3.base.Fetcher +import com.nytimes.android.external.store3.base.Parser import com.nytimes.android.external.store3.base.Persister import com.nytimes.android.external.store3.base.impl.BarCode import com.nytimes.android.external.store3.base.impl.ParsingStoreBuilder @@ -27,7 +28,8 @@ class MoshiSourceParserTest { private val persister: Persister = mock() private val barCode = BarCode("value", KEY) - fun setUp() = runBlocking { + @Test + fun testSourceParser() = runBlocking { val bufferedSource = source(sourceString) assertNotNull(bufferedSource) @@ -40,10 +42,7 @@ class MoshiSourceParserTest { whenever(persister.write(barCode, bufferedSource)) .thenReturn(true) - } - @Test - fun testSourceParser() = runBlocking { val parser = MoshiParserFactory.createSourceParser(Foo::class.java) @@ -65,7 +64,7 @@ class MoshiSourceParserTest { } - @Test + @Test fun testNullMoshi() { expectedException.expect(NullPointerException::class.java) MoshiParserFactory.createSourceParser(null!!, Foo::class.java)