无法测试 API 32 它说无效的日期字符串:无法解析的日期:"bb`baiahbgbdGMT+00:00"



我想要测试乐趣,但它说我有错误无效的日期字符串:无法解析的日期:";bb"baiahbgbdGMT+00:0";我使用模拟器api 32,无法运行测试

> Task :app:connectedDebugAndroidTest FAILED
?? actionable tasks: ? executed, ?? up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: invalid date string: Unparseable date: "bb`baiahbgbdGMT+00:00"

这个代码我想测试这个来自android文档的样本

@RunWith(AndroidJUnit4::class)
@SmallTest
class ExampleInstrumentedTest {
val TEST_STRING = "This is a string"
val TEST_LONG = 12345678L
lateinit var mLogHistory: LogHistory
@Before
fun createLogHistory() {
mLogHistory = LogHistory()
}
@Test
fun logHistory_ParcelableWriteRead() {
// Set up the Parcelable object to send and receive.
mLogHistory.addEntry(TEST_STRING, TEST_LONG)
// Write the data
val parcel = Parcel.obtain()
mLogHistory!!.writeToParcel(parcel, mLogHistory!!.describeContents())
// After you're done with writing, you need to reset the parcel for reading.
parcel.setDataPosition(0)
// Read the data
val createdFromParcel: LogHistory = LogHistory.CREATOR.createFromParcel(parcel)
val createdFromParcelData: List<Pair<String, Long>> = createdFromParcel.data
// Verify that the received data is correct.
assertThat(createdFromParcelData.size).isEqualTo(1)
assertThat(createdFromParcelData[0].first).isEqualTo(TEST_STRING)
assertThat(createdFromParcelData[0].second).isEqualTo(TEST_LONG)
}
}

更改窗口的语言以及日期和时间的格式

最新更新