Add unit tests

This commit is contained in:
Kirill Kamakin
2022-10-31 19:41:49 +01:00
parent 98e082b95e
commit 7c02df4d30
27 changed files with 903 additions and 180 deletions

View File

@@ -9,4 +9,22 @@ data class RecipeIngredientEntity(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "local_id") val localId: Long = 0,
@ColumnInfo(name = "recipe_id") val recipeId: String,
@ColumnInfo(name = "note") val note: String,
)
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as RecipeIngredientEntity
if (recipeId != other.recipeId) return false
if (note != other.note) return false
return true
}
override fun hashCode(): Int {
var result = recipeId.hashCode()
result = 31 * result + note.hashCode()
return result
}
}

View File

@@ -9,4 +9,22 @@ data class RecipeInstructionEntity(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "local_id") val localId: Long = 0,
@ColumnInfo(name = "recipe_id") val recipeId: String,
@ColumnInfo(name = "text") val text: String,
)
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as RecipeInstructionEntity
if (recipeId != other.recipeId) return false
if (text != other.text) return false
return true
}
override fun hashCode(): Int {
var result = recipeId.hashCode()
result = 31 * result + text.hashCode()
return result
}
}