Fix incorrectly incrementing IDs before sending to server. (#1026)
* Fix incorrectly incrementing IDs before sending to server. * Add TimelineRepositoryTest, fix adding placeholder, fix String#dec() * Add more TimelineRepository tests, fix bugs * Add tests for adding statuses from DB.
This commit is contained in:
parent
85610a8311
commit
63952813c8
11 changed files with 631 additions and 208 deletions
50
app/src/test/java/android/text/FakeSpannableString.kt
Normal file
50
app/src/test/java/android/text/FakeSpannableString.kt
Normal file
|
@ -0,0 +1,50 @@
|
|||
package android.text
|
||||
|
||||
// Used for stubbing Android implementation without slow & buggy Robolectric things
|
||||
@Suppress("unused")
|
||||
class SpannableString(private val text: CharSequence) : Spannable {
|
||||
|
||||
override fun setSpan(what: Any?, start: Int, end: Int, flags: Int) {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
|
||||
override fun <T : Any?> getSpans(start: Int, end: Int, type: Class<T>?): Array<T> {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
|
||||
override fun removeSpan(what: Any?) {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "FakeSpannableString[text=$text]"
|
||||
}
|
||||
|
||||
override val length: Int
|
||||
get() = text.length
|
||||
|
||||
|
||||
override fun nextSpanTransition(start: Int, limit: Int, type: Class<*>?): Int {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
|
||||
override fun getSpanEnd(tag: Any?): Int {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
|
||||
override fun getSpanFlags(tag: Any?): Int {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
|
||||
override fun get(index: Int): Char {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
|
||||
override fun subSequence(startIndex: Int, endIndex: Int): CharSequence {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
|
||||
override fun getSpanStart(tag: Any?): Int {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue