Skip to content

Commit 60e53c2

Browse files
committed
PR review round two.
1 parent 8e29d07 commit 60e53c2

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/spans/MarkSpan.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class MarkSpan : CharacterStyle, IAztecInlineSpan {
2626
textColorValue = safelyParseColor(colorString)
2727
}
2828

29-
@VisibleForTesting
30-
internal fun safelyParseColor(colorString: String?): Int? {
29+
private fun safelyParseColor(colorString: String?): Int? {
3130
if (colorString.isNullOrBlank()) {
3231
return null
3332
}

aztec/src/test/kotlin/org/wordpress/aztec/MarkSpanTest.kt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import org.junit.runner.RunWith
88
import org.robolectric.RobolectricTestRunner
99
import org.wordpress.aztec.spans.MarkSpan
1010

11-
@RunWith(RobolectricTestRunner::class)
1211
class MarkSpanTest {
1312
/**
1413
* Test used to confirm two crashes related are fixed.
@@ -18,16 +17,12 @@ class MarkSpanTest {
1817
@Test
1918
fun `Calling MarkSpan#safelyParseColor with empty string should not cause a crash`() {
2019
var error = false
21-
var result: Int? = null
2220
try {
23-
val span = mockk<MarkSpan>()
24-
every { span.safelyParseColor("") } coAnswers { callOriginal() }
25-
result = span.safelyParseColor("")
21+
MarkSpan(colorString = "")
2622
} catch (e: Exception) {
2723
error = true
2824
}
2925
Assert.assertFalse(error)
30-
Assert.assertEquals(null, result)
3126
}
3227

3328
/**
@@ -38,15 +33,11 @@ class MarkSpanTest {
3833
@Test
3934
fun `Calling MarkSpan#safelyParseColor with null string should not cause a crash`() {
4035
var error = false
41-
var result: Int? = null
4236
try {
43-
val span = mockk<MarkSpan>()
44-
every { span.safelyParseColor(null) } coAnswers { callOriginal() }
45-
result = span.safelyParseColor(null)
37+
MarkSpan(colorString = null)
4638
} catch (e: Exception) {
4739
error = true
4840
}
4941
Assert.assertFalse(error)
50-
Assert.assertEquals(null, result)
5142
}
52-
}
43+
}

0 commit comments

Comments
 (0)