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
data class Person( | |
val id: Long, | |
val name: String, | |
val addressLine1: String, | |
val addressLine2: String, | |
val city: String, | |
val country: String, | |
val pincode: Int, | |
val phoneNumber: String | |
) |
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
@Entity | |
data class Person( | |
@PrimaryKey(autoGenerate = true) | |
val id: Long, | |
@SerializedName("name") | |
val personName: String, | |
val addressLine1: String, | |
val addressLine2: String, | |
val city: String, | |
val country: String, |
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
data class Address( | |
val addressLine1: String, | |
val addressLine2: String, | |
val city: String, | |
val country: String, | |
val pincode: Int | |
) |
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
@Entity(primaryKeys = {"categoryId","itemID"}) | |
data class Item { | |
... | |
} |
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
@Entity | |
data class Item { | |
@PrimaryKey | |
@Embedded ItemId id, | |
... | |
} | |
data class ItemId { | |
long categoryId, | |
int itemId |
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
@Entity | |
public class Item { | |
@EmbeddedId ItemId id; | |
... | |
} | |
@Embeddable | |
class ItemId { | |
long categoryId; | |
int itemId; |
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
lateinit var person: Person | |
beforeEachGroup { | |
person = Person( | |
name = "name", | |
address = "address", | |
age = 60, | |
isActive = false | |
) | |
} |
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
object PersonSpec : Spek({ | |
}) |
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
describe("isPersonRetired") { | |
describe("when isActive is true") { | |
beforeEachGroup { | |
person = person.copy(isActive = true) | |
} | |
describe("when getAge is greater than RETIREMENT_AGE") { | |
beforeEachGroup { person = person.copy(age = 65) } | |
} | |
describe("when getAge is less than RETIREMENT_AGE") { | |
beforeEachGroup { person = person.copy(age = 55) } |
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
describe("when isActive is false") { | |
beforeEachGroup { | |
person = person.copy(isActive = false) | |
} | |
... | |
describe("when getAge is less than RETIREMENT_AGE") { | |
beforeEachGroup { | |
person = person.copy(age = 55) | |
} | |
it("should return false") { |
OlderNewer