Skip to content

Commit 351d717

Browse files
committed
Fix tests
Fix tests by removing deprecated AndroidTestCase
1 parent 9b26579 commit 351d717

File tree

5 files changed

+5
-44
lines changed

5 files changed

+5
-44
lines changed

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
package org.wordpress.aztec
44

5-
import android.test.AndroidTestCase
65
import android.text.SpannableString
76
import android.text.SpannableStringBuilder
8-
import androidx.test.core.app.ApplicationProvider
97
import org.junit.Assert
10-
import org.junit.Before
118
import org.junit.Ignore
129
import org.junit.Test
1310
import org.junit.runner.RunWith
@@ -18,7 +15,7 @@ import org.robolectric.RuntimeEnvironment
1815
* Tests for [AztecParser].
1916
*/
2017
@RunWith(ParameterizedRobolectricTestRunner::class)
21-
class AztecParserTest(alignmentRendering: AlignmentRendering) : AndroidTestCase() {
18+
class AztecParserTest(alignmentRendering: AlignmentRendering) {
2219
private var mParser = AztecParser(alignmentRendering)
2320
private val HTML_BOLD = "<b>Bold</b><br><br>"
2421
private val HTML_LIST_ORDERED = "<ol><li>Ordered</li></ol>"
@@ -96,14 +93,6 @@ class AztecParserTest(alignmentRendering: AlignmentRendering) : AndroidTestCase(
9693
}
9794
}
9895

99-
/**
100-
* Initialize variables.
101-
*/
102-
@Before
103-
fun init() {
104-
context = ApplicationProvider.getApplicationContext()
105-
}
106-
10796
/**
10897
* Parse all text from HTML to span to HTML. If input and output are equal with
10998
* the same length and corresponding characters, [AztecParser] is correct.

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@
22

33
package org.wordpress.aztec
44

5-
import android.test.AndroidTestCase
65
import android.text.SpannableString
76
import android.text.SpannableStringBuilder
8-
import androidx.test.core.app.ApplicationProvider
97
import junit.framework.Assert
10-
import org.junit.Before
118
import org.junit.Test
129
import org.junit.runner.RunWith
1310
import org.robolectric.RobolectricTestRunner
1411
import org.robolectric.RuntimeEnvironment
1512
import org.wordpress.aztec.source.Format
1613

1714
@RunWith(RobolectricTestRunner::class)
18-
class CalypsoFormattingTest : AndroidTestCase() {
15+
class CalypsoFormattingTest {
1916
private var parser = AztecParser(AlignmentRendering.SPAN_LEVEL)
2017

2118
private val HTML_LINE_BREAKS = "HI<br><br><br><br><br><br>BYE"
@@ -97,14 +94,6 @@ class CalypsoFormattingTest : AndroidTestCase() {
9794
"<div class=\"sec $8 ond\"></div>\n" +
9895
"</div>"
9996

100-
/**
101-
* Initialize variables.
102-
*/
103-
@Before
104-
fun init() {
105-
context = ApplicationProvider.getApplicationContext()
106-
}
107-
10897
/**
10998
* Test the conversion from HTML to visual mode with nested HTML (Calypso format)
11099
*

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
package org.wordpress.aztec
44

5-
import android.test.AndroidTestCase
65
import android.text.SpannableString
7-
import androidx.test.core.app.ApplicationProvider
86
import junit.framework.Assert
97
import org.junit.Before
108
import org.junit.Test
@@ -17,7 +15,7 @@ import org.wordpress.aztec.spans.AztecStyleBoldSpan
1715

1816
@RunWith(RobolectricTestRunner::class)
1917
@Config(sdk = [24, 25])
20-
class CssStyleAttributeTest : AndroidTestCase() {
18+
class CssStyleAttributeTest {
2119

2220
private val EMPTY_STYLE_HTML = "<b>bold</b>"
2321
private val HTML = "<b style=\"name:value;\">bold</b>"
@@ -27,7 +25,6 @@ class CssStyleAttributeTest : AndroidTestCase() {
2725

2826
@Before
2927
fun init() {
30-
context = ApplicationProvider.getApplicationContext()
3128
parser = AztecParser(AlignmentRendering.SPAN_LEVEL)
3229
}
3330

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
package org.wordpress.aztec
44

5-
import android.test.AndroidTestCase
65
import android.text.SpannableString
76
import android.text.style.ForegroundColorSpan
8-
import androidx.test.core.app.ApplicationProvider
97
import junit.framework.Assert
108
import org.junit.Before
119
import org.junit.Test
@@ -30,7 +28,7 @@ import org.wordpress.aztec.spans.IAztecAttributedSpan
3028
*/
3129
@RunWith(RobolectricTestRunner::class)
3230
@Config(sdk = [24, 25])
33-
class HtmlAttributeStyleColorTest : AndroidTestCase() {
31+
class HtmlAttributeStyleColorTest {
3432

3533
private val HTML_BOLD_STYLE_COLOR = "<b style=\"color:blue;\">Blue</b>"
3634
private val HTML_BOLD_STYLE_INVALID = "<b style=\"color:@java;\">Blue</b>"
@@ -45,7 +43,6 @@ class HtmlAttributeStyleColorTest : AndroidTestCase() {
4543

4644
@Before
4745
fun init() {
48-
context = ApplicationProvider.getApplicationContext()
4946
parser = AztecParser(AlignmentRendering.SPAN_LEVEL)
5047
}
5148

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22

33
package org.wordpress.aztec
44

5-
import android.test.AndroidTestCase
65
import android.text.SpannableString
7-
import androidx.test.core.app.ApplicationProvider
86
import junit.framework.Assert
9-
import org.junit.Before
107
import org.junit.Test
118
import org.junit.runner.RunWith
129
import org.robolectric.RobolectricTestRunner
1310
import org.robolectric.RuntimeEnvironment
1411
import org.wordpress.aztec.source.Format
1512

1613
@RunWith(RobolectricTestRunner::class)
17-
class HtmlFormattingTest : AndroidTestCase() {
14+
class HtmlFormattingTest {
1815

1916
private var parser = AztecParser(AlignmentRendering.SPAN_LEVEL)
2017

@@ -166,14 +163,6 @@ class HtmlFormattingTest : AndroidTestCase() {
166163
private val HTML_NESTED_BOLD_TAGS_HTML_PROCESSING_OUTPUT =
167164
"<b>Test post</b> <b></b><br><br>Our room with a view[/caption] Test end"
168165

169-
/**
170-
* Initialize variables.
171-
*/
172-
@Before
173-
fun init() {
174-
context = ApplicationProvider.getApplicationContext()
175-
}
176-
177166
/**
178167
* Test the conversion from HTML to visual mode with nested HTML
179168
*

0 commit comments

Comments
 (0)