mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-31 23:03:54 +01:00
Snak_partial.kt & Statement_partial.kt: refactored to remove underscores in class names to meet ktLint standard
This commit is contained in:
parent
e07442418f
commit
4717ce0a58
13 changed files with 46 additions and 46 deletions
|
|
@ -10,7 +10,7 @@ import fr.free.nrw.commons.wikidata.WikidataProperties
|
||||||
import fr.free.nrw.commons.wikidata.model.DataValue
|
import fr.free.nrw.commons.wikidata.model.DataValue
|
||||||
import fr.free.nrw.commons.wikidata.model.DepictSearchItem
|
import fr.free.nrw.commons.wikidata.model.DepictSearchItem
|
||||||
import fr.free.nrw.commons.wikidata.model.Entities
|
import fr.free.nrw.commons.wikidata.model.Entities
|
||||||
import fr.free.nrw.commons.wikidata.model.Statement_partial
|
import fr.free.nrw.commons.wikidata.model.StatementPartial
|
||||||
import io.reactivex.Single
|
import io.reactivex.Single
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
@ -111,7 +111,7 @@ class DepictsClient
|
||||||
/**
|
/**
|
||||||
* returns list of id ex. "Q2323" from Statement_partial
|
* returns list of id ex. "Q2323" from Statement_partial
|
||||||
*/
|
*/
|
||||||
private fun List<Statement_partial>?.toIds(): List<String> =
|
private fun List<StatementPartial>?.toIds(): List<String> =
|
||||||
this
|
this
|
||||||
?.map { it.mainSnak.dataValue }
|
?.map { it.mainSnak.dataValue }
|
||||||
?.filterIsInstance<DataValue.EntityId>()
|
?.filterIsInstance<DataValue.EntityId>()
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package fr.free.nrw.commons.upload.depicts
|
package fr.free.nrw.commons.upload.depicts
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
import fr.free.nrw.commons.wikidata.model.Statement_partial
|
import fr.free.nrw.commons.wikidata.model.StatementPartial
|
||||||
|
|
||||||
data class Claims(
|
data class Claims(
|
||||||
@SerializedName(value = "claims")
|
@SerializedName(value = "claims")
|
||||||
val claims: Map<String, List<Statement_partial>> = emptyMap(),
|
val claims: Map<String, List<StatementPartial>> = emptyMap(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import fr.free.nrw.commons.wikidata.WikidataProperties.IMAGE
|
||||||
import fr.free.nrw.commons.wikidata.WikidataProperties.INSTANCE_OF
|
import fr.free.nrw.commons.wikidata.WikidataProperties.INSTANCE_OF
|
||||||
import fr.free.nrw.commons.wikidata.model.DataValue
|
import fr.free.nrw.commons.wikidata.model.DataValue
|
||||||
import fr.free.nrw.commons.wikidata.model.Entities
|
import fr.free.nrw.commons.wikidata.model.Entities
|
||||||
import fr.free.nrw.commons.wikidata.model.Statement_partial
|
import fr.free.nrw.commons.wikidata.model.StatementPartial
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
|
|
@ -78,14 +78,14 @@ data class DepictedItem constructor(
|
||||||
override fun hashCode(): Int = name.hashCode()
|
override fun hashCode(): Int = name.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun List<Statement_partial>?.toIds(): List<String> =
|
private fun List<StatementPartial>?.toIds(): List<String> =
|
||||||
this
|
this
|
||||||
?.map { it.mainSnak.dataValue }
|
?.map { it.mainSnak.dataValue }
|
||||||
?.filterIsInstance<DataValue.EntityId>()
|
?.filterIsInstance<DataValue.EntityId>()
|
||||||
?.map { it.value.id }
|
?.map { it.value.id }
|
||||||
?: emptyList()
|
?: emptyList()
|
||||||
|
|
||||||
private val List<Statement_partial>?.primaryImageValue: DataValue.ValueString?
|
private val List<StatementPartial>?.primaryImageValue: DataValue.ValueString?
|
||||||
get() = this?.firstOrNull()?.mainSnak?.dataValue as? DataValue.ValueString
|
get() = this?.firstOrNull()?.mainSnak?.dataValue as? DataValue.ValueString
|
||||||
|
|
||||||
operator fun Entities.Entity.get(property: WikidataProperties) = statements?.get(property.propertyName)
|
operator fun Entities.Entity.get(property: WikidataProperties) = statements?.get(property.propertyName)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package fr.free.nrw.commons.wikidata
|
package fr.free.nrw.commons.wikidata
|
||||||
|
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import fr.free.nrw.commons.wikidata.model.Statement_partial
|
import fr.free.nrw.commons.wikidata.model.StatementPartial
|
||||||
import fr.free.nrw.commons.wikidata.model.WbCreateClaimResponse
|
import fr.free.nrw.commons.wikidata.model.WbCreateClaimResponse
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
@ -20,7 +20,7 @@ class WikidataClient
|
||||||
* @return revisionID of the edit
|
* @return revisionID of the edit
|
||||||
*/
|
*/
|
||||||
fun setClaim(
|
fun setClaim(
|
||||||
claim: Statement_partial?,
|
claim: StatementPartial?,
|
||||||
tags: String?,
|
tags: String?,
|
||||||
): Observable<Long> =
|
): Observable<Long> =
|
||||||
csrfToken()
|
csrfToken()
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ import fr.free.nrw.commons.wikidata.model.DataValue;
|
||||||
import fr.free.nrw.commons.wikidata.model.DataValue.ValueString;
|
import fr.free.nrw.commons.wikidata.model.DataValue.ValueString;
|
||||||
import fr.free.nrw.commons.wikidata.model.EditClaim;
|
import fr.free.nrw.commons.wikidata.model.EditClaim;
|
||||||
import fr.free.nrw.commons.wikidata.model.RemoveClaim;
|
import fr.free.nrw.commons.wikidata.model.RemoveClaim;
|
||||||
import fr.free.nrw.commons.wikidata.model.Snak_partial;
|
import fr.free.nrw.commons.wikidata.model.SnakPartial;
|
||||||
import fr.free.nrw.commons.wikidata.model.Statement_partial;
|
import fr.free.nrw.commons.wikidata.model.StatementPartial;
|
||||||
import fr.free.nrw.commons.wikidata.model.WikiBaseMonolingualTextValue;
|
import fr.free.nrw.commons.wikidata.model.WikiBaseMonolingualTextValue;
|
||||||
import fr.free.nrw.commons.wikidata.mwapi.MwPostResponse;
|
import fr.free.nrw.commons.wikidata.mwapi.MwPostResponse;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
|
|
@ -198,19 +198,19 @@ public class WikidataEditService {
|
||||||
|
|
||||||
public Long addImageAndMediaLegends(final WikidataItem wikidataItem, final String fileName,
|
public Long addImageAndMediaLegends(final WikidataItem wikidataItem, final String fileName,
|
||||||
final Map<String, String> captions) {
|
final Map<String, String> captions) {
|
||||||
final Snak_partial p18 = new Snak_partial("value",
|
final SnakPartial p18 = new SnakPartial("value",
|
||||||
WikidataProperties.IMAGE.getPropertyName(),
|
WikidataProperties.IMAGE.getPropertyName(),
|
||||||
new ValueString(fileName.replace("File:", "")));
|
new ValueString(fileName.replace("File:", "")));
|
||||||
|
|
||||||
final List<Snak_partial> snaks = new ArrayList<>();
|
final List<SnakPartial> snaks = new ArrayList<>();
|
||||||
for (final Map.Entry<String, String> entry : captions.entrySet()) {
|
for (final Map.Entry<String, String> entry : captions.entrySet()) {
|
||||||
snaks.add(new Snak_partial("value",
|
snaks.add(new SnakPartial("value",
|
||||||
WikidataProperties.MEDIA_LEGENDS.getPropertyName(), new DataValue.MonoLingualText(
|
WikidataProperties.MEDIA_LEGENDS.getPropertyName(), new DataValue.MonoLingualText(
|
||||||
new WikiBaseMonolingualTextValue(entry.getValue(), entry.getKey()))));
|
new WikiBaseMonolingualTextValue(entry.getValue(), entry.getKey()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
final String id = wikidataItem.getId() + "$" + UUID.randomUUID().toString();
|
final String id = wikidataItem.getId() + "$" + UUID.randomUUID().toString();
|
||||||
final Statement_partial claim = new Statement_partial(p18, "statement", "normal", id,
|
final StatementPartial claim = new StatementPartial(p18, "statement", "normal", id,
|
||||||
Collections.singletonMap(WikidataProperties.MEDIA_LEGENDS.getPropertyName(), snaks),
|
Collections.singletonMap(WikidataProperties.MEDIA_LEGENDS.getPropertyName(), snaks),
|
||||||
Arrays.asList(WikidataProperties.MEDIA_LEGENDS.getPropertyName()));
|
Arrays.asList(WikidataProperties.MEDIA_LEGENDS.getPropertyName()));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ sealed class DataValue(
|
||||||
.of(DataValue::class.java, DataValue::type.name)
|
.of(DataValue::class.java, DataValue::type.name)
|
||||||
.registerSubtype(EntityId::class.java, EntityId.TYPE)
|
.registerSubtype(EntityId::class.java, EntityId.TYPE)
|
||||||
.registerSubtype(ValueString::class.java, ValueString.TYPE)
|
.registerSubtype(ValueString::class.java, ValueString.TYPE)
|
||||||
.registerSubtype(GlobeCoordinate_partial::class.java, GlobeCoordinate_partial.TYPE)
|
.registerSubtype(GlobeCoordinatePartial::class.java, GlobeCoordinatePartial.TYPE)
|
||||||
.registerSubtype(Time_partial::class.java, Time_partial.TYPE)
|
.registerSubtype(TimePartial::class.java, TimePartial.TYPE)
|
||||||
.registerSubtype(Quantity_partial::class.java, Quantity_partial.TYPE)
|
.registerSubtype(QuantityPartial::class.java, QuantityPartial.TYPE)
|
||||||
.registerSubtype(MonoLingualText::class.java, MonoLingualText.TYPE)
|
.registerSubtype(MonoLingualText::class.java, MonoLingualText.TYPE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ sealed class DataValue(
|
||||||
// },
|
// },
|
||||||
// "type": "globecoordinate"
|
// "type": "globecoordinate"
|
||||||
// }
|
// }
|
||||||
class GlobeCoordinate_partial : DataValue(TYPE) {
|
class GlobeCoordinatePartial : DataValue(TYPE) {
|
||||||
companion object {
|
companion object {
|
||||||
const val TYPE = "globecoordinate"
|
const val TYPE = "globecoordinate"
|
||||||
}
|
}
|
||||||
|
|
@ -70,7 +70,7 @@ sealed class DataValue(
|
||||||
// },
|
// },
|
||||||
// "type": "time"
|
// "type": "time"
|
||||||
// }
|
// }
|
||||||
class Time_partial : DataValue(TYPE) {
|
class TimePartial : DataValue(TYPE) {
|
||||||
companion object {
|
companion object {
|
||||||
const val TYPE = "time"
|
const val TYPE = "time"
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ sealed class DataValue(
|
||||||
// "unit": "http://www.wikidata.org/entity/Q828224"
|
// "unit": "http://www.wikidata.org/entity/Q828224"
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
class Quantity_partial : DataValue(TYPE) {
|
class QuantityPartial : DataValue(TYPE) {
|
||||||
companion object {
|
companion object {
|
||||||
const val TYPE = "quantity"
|
const val TYPE = "quantity"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package fr.free.nrw.commons.wikidata.model
|
package fr.free.nrw.commons.wikidata.model
|
||||||
|
|
||||||
data class EditClaim(
|
data class EditClaim(
|
||||||
val claims: List<Statement_partial>,
|
val claims: List<StatementPartial>,
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
@ -9,12 +9,12 @@ data class EditClaim(
|
||||||
entityIds: List<String>,
|
entityIds: List<String>,
|
||||||
propertyName: String,
|
propertyName: String,
|
||||||
): EditClaim {
|
): EditClaim {
|
||||||
val list = mutableListOf<Statement_partial>()
|
val list = mutableListOf<StatementPartial>()
|
||||||
entityIds.forEach {
|
entityIds.forEach {
|
||||||
list.add(
|
list.add(
|
||||||
Statement_partial(
|
StatementPartial(
|
||||||
mainSnak =
|
mainSnak =
|
||||||
Snak_partial(
|
SnakPartial(
|
||||||
snakType = "value",
|
snakType = "value",
|
||||||
property = propertyName,
|
property = propertyName,
|
||||||
dataValue =
|
dataValue =
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public class Entities extends MwResponse {
|
||||||
@Nullable private Map<String, Label> labels;
|
@Nullable private Map<String, Label> labels;
|
||||||
@Nullable private Map<String, Label> descriptions;
|
@Nullable private Map<String, Label> descriptions;
|
||||||
@Nullable private Map<String, SiteLink> sitelinks;
|
@Nullable private Map<String, SiteLink> sitelinks;
|
||||||
@Nullable @SerializedName(value = "statements", alternate = "claims") private Map<String, List<Statement_partial>> statements;
|
@Nullable @SerializedName(value = "statements", alternate = "claims") private Map<String, List<StatementPartial>> statements;
|
||||||
@Nullable private String missing;
|
@Nullable private String missing;
|
||||||
|
|
||||||
@NonNull public String id() {
|
@NonNull public String id() {
|
||||||
|
|
@ -64,7 +64,7 @@ public class Entities extends MwResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Map<String, List<Statement_partial>> getStatements() {
|
public Map<String, List<StatementPartial>> getStatements() {
|
||||||
return statements;
|
return statements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import com.google.gson.annotations.SerializedName
|
||||||
},
|
},
|
||||||
"datatype": "wikibase-item",
|
"datatype": "wikibase-item",
|
||||||
}*/
|
}*/
|
||||||
data class Snak_partial(
|
data class SnakPartial(
|
||||||
@SerializedName("snaktype") val snakType: String,
|
@SerializedName("snaktype") val snakType: String,
|
||||||
val property: String,
|
val property: String,
|
||||||
@SerializedName("datavalue") val dataValue: DataValue,
|
@SerializedName("datavalue") val dataValue: DataValue,
|
||||||
|
|
@ -18,11 +18,11 @@ import com.google.gson.annotations.SerializedName
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}*/
|
}*/
|
||||||
data class Statement_partial(
|
data class StatementPartial(
|
||||||
@SerializedName("mainsnak") val mainSnak: Snak_partial,
|
@SerializedName("mainsnak") val mainSnak: SnakPartial,
|
||||||
val type: String,
|
val type: String,
|
||||||
val rank: String,
|
val rank: String,
|
||||||
val id: String? = null,
|
val id: String? = null,
|
||||||
val qualifiers: Map<String, List<Snak_partial>> = mapOf(),
|
val qualifiers: Map<String, List<SnakPartial>> = mapOf(),
|
||||||
@SerializedName("qualifiers-order") val qualifiersOrder: List<String> = listOf(),
|
@SerializedName("qualifiers-order") val qualifiersOrder: List<String> = listOf(),
|
||||||
)
|
)
|
||||||
|
|
@ -10,8 +10,8 @@ import fr.free.nrw.commons.upload.structure.depictions.DepictedItem
|
||||||
import fr.free.nrw.commons.wikidata.model.DataValue
|
import fr.free.nrw.commons.wikidata.model.DataValue
|
||||||
import fr.free.nrw.commons.wikidata.model.DepictSearchItem
|
import fr.free.nrw.commons.wikidata.model.DepictSearchItem
|
||||||
import fr.free.nrw.commons.wikidata.model.Entities
|
import fr.free.nrw.commons.wikidata.model.Entities
|
||||||
import fr.free.nrw.commons.wikidata.model.Snak_partial
|
import fr.free.nrw.commons.wikidata.model.SnakPartial
|
||||||
import fr.free.nrw.commons.wikidata.model.Statement_partial
|
import fr.free.nrw.commons.wikidata.model.StatementPartial
|
||||||
import fr.free.nrw.commons.wikidata.model.WikiBaseEntityValue
|
import fr.free.nrw.commons.wikidata.model.WikiBaseEntityValue
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
|
|
@ -104,23 +104,23 @@ fun wikiBaseEntityValue(
|
||||||
) = WikiBaseEntityValue(entityType, id, numericId)
|
) = WikiBaseEntityValue(entityType, id, numericId)
|
||||||
|
|
||||||
fun statement(
|
fun statement(
|
||||||
mainSnak: Snak_partial = snak(),
|
mainSnak: SnakPartial = snak(),
|
||||||
rank: String = "rank",
|
rank: String = "rank",
|
||||||
type: String = "type",
|
type: String = "type",
|
||||||
) = Statement_partial(mainSnak, type, rank)
|
) = StatementPartial(mainSnak, type, rank)
|
||||||
|
|
||||||
fun snak(
|
fun snak(
|
||||||
snakType: String = "type",
|
snakType: String = "type",
|
||||||
property: String = "property",
|
property: String = "property",
|
||||||
dataValue: DataValue = valueString(""),
|
dataValue: DataValue = valueString(""),
|
||||||
) = Snak_partial(snakType, property, dataValue)
|
) = SnakPartial(snakType, property, dataValue)
|
||||||
|
|
||||||
fun valueString(value: String) = DataValue.ValueString(value)
|
fun valueString(value: String) = DataValue.ValueString(value)
|
||||||
|
|
||||||
fun entity(
|
fun entity(
|
||||||
labels: Map<String, String> = emptyMap(),
|
labels: Map<String, String> = emptyMap(),
|
||||||
descriptions: Map<String, String> = emptyMap(),
|
descriptions: Map<String, String> = emptyMap(),
|
||||||
statements: Map<String, List<Statement_partial>>? = emptyMap(),
|
statements: Map<String, List<StatementPartial>>? = emptyMap(),
|
||||||
id: String = "id",
|
id: String = "id",
|
||||||
) = mock<Entities.Entity>().apply {
|
) = mock<Entities.Entity>().apply {
|
||||||
val mockedLabels = labels.mockLabels()
|
val mockedLabels = labels.mockLabels()
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ import fr.free.nrw.commons.upload.structure.depictions.DepictedItem
|
||||||
import fr.free.nrw.commons.wikidata.model.DataValue
|
import fr.free.nrw.commons.wikidata.model.DataValue
|
||||||
import fr.free.nrw.commons.wikidata.model.DepictSearchResponse
|
import fr.free.nrw.commons.wikidata.model.DepictSearchResponse
|
||||||
import fr.free.nrw.commons.wikidata.model.Entities
|
import fr.free.nrw.commons.wikidata.model.Entities
|
||||||
import fr.free.nrw.commons.wikidata.model.Snak_partial
|
import fr.free.nrw.commons.wikidata.model.SnakPartial
|
||||||
import fr.free.nrw.commons.wikidata.model.Statement_partial
|
import fr.free.nrw.commons.wikidata.model.StatementPartial
|
||||||
import fr.free.nrw.commons.wikidata.model.WikiBaseEntityValue
|
import fr.free.nrw.commons.wikidata.model.WikiBaseEntityValue
|
||||||
import io.reactivex.Single
|
import io.reactivex.Single
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
|
|
@ -67,12 +67,12 @@ class DepictsClientTest {
|
||||||
whenever(binding2.id).thenReturn("2")
|
whenever(binding2.id).thenReturn("2")
|
||||||
val entities = mock<Entities>()
|
val entities = mock<Entities>()
|
||||||
val entity = mock<Entities.Entity>()
|
val entity = mock<Entities.Entity>()
|
||||||
val statementPartial = mock<Statement_partial>()
|
val statementPartial = mock<StatementPartial>()
|
||||||
whenever(depictsInterface.getEntities("1|2")).thenReturn(Single.just(entities))
|
whenever(depictsInterface.getEntities("1|2")).thenReturn(Single.just(entities))
|
||||||
whenever(entities.entities()).thenReturn(mapOf("en" to entity))
|
whenever(entities.entities()).thenReturn(mapOf("en" to entity))
|
||||||
whenever(entity.statements).thenReturn(mapOf("P31" to listOf(statementPartial)))
|
whenever(entity.statements).thenReturn(mapOf("P31" to listOf(statementPartial)))
|
||||||
whenever(statementPartial.mainSnak).thenReturn(
|
whenever(statementPartial.mainSnak).thenReturn(
|
||||||
Snak_partial(
|
SnakPartial(
|
||||||
"test",
|
"test",
|
||||||
"P31",
|
"P31",
|
||||||
DataValue.EntityId(
|
DataValue.EntityId(
|
||||||
|
|
@ -165,10 +165,10 @@ class DepictsClientTest {
|
||||||
fun `Test mapToDepictItem when description is empty and P31 exists`() {
|
fun `Test mapToDepictItem when description is empty and P31 exists`() {
|
||||||
val entities = mock<Entities>()
|
val entities = mock<Entities>()
|
||||||
val entity = mock<Entities.Entity>()
|
val entity = mock<Entities.Entity>()
|
||||||
val statementPartial = mock<Statement_partial>()
|
val statementPartial = mock<StatementPartial>()
|
||||||
whenever(entity.statements).thenReturn(mapOf("P31" to listOf(statementPartial)))
|
whenever(entity.statements).thenReturn(mapOf("P31" to listOf(statementPartial)))
|
||||||
whenever(statementPartial.mainSnak).thenReturn(
|
whenever(statementPartial.mainSnak).thenReturn(
|
||||||
Snak_partial(
|
SnakPartial(
|
||||||
"test",
|
"test",
|
||||||
"P31",
|
"P31",
|
||||||
DataValue.EntityId(
|
DataValue.EntityId(
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package fr.free.nrw.commons.wikidata
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.nhaarman.mockitokotlin2.whenever
|
import com.nhaarman.mockitokotlin2.whenever
|
||||||
import fr.free.nrw.commons.wikidata.model.PageInfo
|
import fr.free.nrw.commons.wikidata.model.PageInfo
|
||||||
import fr.free.nrw.commons.wikidata.model.Statement_partial
|
import fr.free.nrw.commons.wikidata.model.StatementPartial
|
||||||
import fr.free.nrw.commons.wikidata.model.WbCreateClaimResponse
|
import fr.free.nrw.commons.wikidata.model.WbCreateClaimResponse
|
||||||
import fr.free.nrw.commons.wikidata.mwapi.MwQueryResponse
|
import fr.free.nrw.commons.wikidata.mwapi.MwQueryResponse
|
||||||
import fr.free.nrw.commons.wikidata.mwapi.MwQueryResult
|
import fr.free.nrw.commons.wikidata.mwapi.MwQueryResult
|
||||||
|
|
@ -48,8 +48,8 @@ class WikidataClientTest {
|
||||||
whenever(response.pageinfo).thenReturn(pageInfo)
|
whenever(response.pageinfo).thenReturn(pageInfo)
|
||||||
`when`(wikidataInterface!!.postSetClaim(anyString(), anyString(), anyString()))
|
`when`(wikidataInterface!!.postSetClaim(anyString(), anyString(), anyString()))
|
||||||
.thenReturn(Observable.just(response))
|
.thenReturn(Observable.just(response))
|
||||||
whenever(gson!!.toJson(any(Statement_partial::class.java))).thenReturn("claim")
|
whenever(gson!!.toJson(any(StatementPartial::class.java))).thenReturn("claim")
|
||||||
val request = mock(Statement_partial::class.java)
|
val request = mock(StatementPartial::class.java)
|
||||||
|
|
||||||
val claim =
|
val claim =
|
||||||
wikidataClient!!
|
wikidataClient!!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue