-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert com.facebook.testutils.shadows to Kotlin (#47487)
Summary: Pull Request resolved: #47487 Changelog: [Android][Deprecated] Deprecated shadows for ReadableNative[Map|Array].[Readable|Writable] Reviewed By: rshest Differential Revision: D65597417 fbshipit-source-id: 61f649c32fb91a13af075aa65869093f31d218e3
- Loading branch information
1 parent
eb5fbdf
commit d424bb9
Showing
12 changed files
with
215 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 0 additions & 90 deletions
90
.../ReactAndroid/src/test/java/com/facebook/testutils/shadows/ShadowReadableNativeArray.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
...ve/ReactAndroid/src/test/java/com/facebook/testutils/shadows/ShadowReadableNativeArray.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.testutils.shadows | ||
|
||
import com.facebook.react.bridge.Dynamic | ||
import com.facebook.react.bridge.ReadableArray | ||
import com.facebook.react.bridge.ReadableMap | ||
import com.facebook.react.bridge.ReadableNativeArray | ||
import com.facebook.react.bridge.ReadableType | ||
import java.util.ArrayList | ||
import org.robolectric.annotation.Implementation | ||
import org.robolectric.annotation.Implements | ||
|
||
@Implements(ReadableNativeArray::class) | ||
open class ShadowReadableNativeArray : ShadowNativeArray(), ReadableArray { | ||
|
||
@Implementation override fun size(): Int = backingArray.size() | ||
|
||
@Implementation override fun isNull(index: Int): Boolean = backingArray.isNull(index) | ||
|
||
@Implementation override fun getBoolean(index: Int): Boolean = backingArray.getBoolean(index) | ||
|
||
@Implementation override fun getDouble(index: Int): Double = backingArray.getDouble(index) | ||
|
||
@Implementation override fun getInt(index: Int): Int = backingArray.getInt(index) | ||
|
||
@Implementation override fun getLong(index: Int): Long = backingArray.getLong(index) | ||
|
||
@Implementation override fun getString(index: Int): String? = backingArray.getString(index) | ||
|
||
@Implementation override fun getArray(index: Int): ReadableArray? = backingArray.getArray(index) | ||
|
||
@Implementation override fun getMap(index: Int): ReadableMap? = backingArray.getMap(index) | ||
|
||
@Implementation override fun getDynamic(index: Int): Dynamic = backingArray.getDynamic(index) | ||
|
||
@Implementation override fun getType(index: Int): ReadableType = backingArray.getType(index) | ||
|
||
@Implementation override fun toArrayList(): ArrayList<Any?> = backingArray.toArrayList() | ||
} |
104 changes: 0 additions & 104 deletions
104
...ve/ReactAndroid/src/test/java/com/facebook/testutils/shadows/ShadowReadableNativeMap.java
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
...tive/ReactAndroid/src/test/java/com/facebook/testutils/shadows/ShadowReadableNativeMap.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.testutils.shadows | ||
|
||
import com.facebook.react.bridge.Dynamic | ||
import com.facebook.react.bridge.ReadableArray | ||
import com.facebook.react.bridge.ReadableMap | ||
import com.facebook.react.bridge.ReadableMapKeySetIterator | ||
import com.facebook.react.bridge.ReadableNativeMap | ||
import com.facebook.react.bridge.ReadableType | ||
import java.util.HashMap | ||
import org.robolectric.annotation.Implementation | ||
import org.robolectric.annotation.Implements | ||
|
||
@Implements(ReadableNativeMap::class) | ||
open class ShadowReadableNativeMap : ShadowNativeMap(), ReadableMap { | ||
|
||
@Implementation override fun hasKey(name: String): Boolean = backingMap.hasKey(name) | ||
|
||
@Implementation override fun isNull(name: String): Boolean = backingMap.isNull(name) | ||
|
||
@Implementation override fun getBoolean(name: String): Boolean = backingMap.getBoolean(name) | ||
|
||
@Implementation override fun getDouble(name: String): Double = backingMap.getDouble(name) | ||
|
||
@Implementation override fun getInt(name: String): Int = backingMap.getInt(name) | ||
|
||
@Implementation override fun getLong(name: String): Long = backingMap.getLong(name) | ||
|
||
@Implementation override fun getString(name: String): String? = backingMap.getString(name) | ||
|
||
@Implementation override fun getArray(name: String): ReadableArray? = backingMap.getArray(name) | ||
|
||
@Implementation override fun getMap(name: String): ReadableMap? = backingMap.getMap(name) | ||
|
||
@Implementation override fun getDynamic(name: String): Dynamic = backingMap.getDynamic(name) | ||
|
||
@Implementation override fun getType(name: String): ReadableType = backingMap.getType(name) | ||
|
||
@get:Implementation | ||
override val entryIterator: Iterator<Map.Entry<String, Any?>> | ||
get() = backingMap.entryIterator | ||
|
||
@Implementation | ||
override fun keySetIterator(): ReadableMapKeySetIterator = backingMap.keySetIterator() | ||
|
||
@Implementation override fun toHashMap(): HashMap<String, Any?> = backingMap.toHashMap() | ||
} |
Oops, something went wrong.