mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-09 03:31:28 +00:00
Refactor: Separate packages\files
This commit is contained in:
parent
4f4d0243a0
commit
b5b7ffc870
@ -1,10 +0,0 @@
|
|||||||
package com.gildedrose
|
|
||||||
|
|
||||||
//Check git works
|
|
||||||
//open class Item(var name: String, var sellIn: Int, var quality: Int) {
|
|
||||||
// override fun toString(): String {
|
|
||||||
// return this.name + ", " + this.sellIn + ", " + this.quality
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
data class Item(var name: String, var sellIn: Int, var quality: Int)
|
|
||||||
@ -1,19 +1,7 @@
|
|||||||
package com.gildedrose
|
package com.gildedrose
|
||||||
|
|
||||||
object ItemRepository {
|
import com.gildedrose.data.constants.ItemRepository
|
||||||
val items = listOf(
|
|
||||||
Item("+5 Dexterity Vest", 10, 20), //
|
|
||||||
Item("Aged Brie", 2, 0), //
|
|
||||||
Item("Elixir of the Mongoose", 5, 7), //
|
|
||||||
Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
|
||||||
Item("Sulfuras, Hand of Ragnaros", -1, 80),
|
|
||||||
Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
|
||||||
Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
|
||||||
Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
|
||||||
// this conjured item does not work properly yet
|
|
||||||
Item("Conjured Mana Cake", 3, 6)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
//asd
|
//asd
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.gildedrose.data.constants
|
||||||
|
|
||||||
|
import com.gildedrose.data.model.Item
|
||||||
|
|
||||||
|
object ItemRepository {
|
||||||
|
val items = listOf(
|
||||||
|
Item("+5 Dexterity Vest", 10, 20), //
|
||||||
|
Item("Aged Brie", 2, 0), //
|
||||||
|
Item("Elixir of the Mongoose", 5, 7), //
|
||||||
|
Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
||||||
|
Item("Sulfuras, Hand of Ragnaros", -1, 80),
|
||||||
|
Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
||||||
|
Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
||||||
|
Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
||||||
|
// this conjured item does not work properly yet
|
||||||
|
Item("Conjured Mana Cake", 3, 6)
|
||||||
|
)
|
||||||
|
}
|
||||||
3
Kotlin/src/main/kotlin/com/gildedrose/data/model/Item.kt
Normal file
3
Kotlin/src/main/kotlin/com/gildedrose/data/model/Item.kt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package com.gildedrose.data.model
|
||||||
|
|
||||||
|
data class Item(var name: String, var sellIn: Int, var quality: Int)
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.gildedrose
|
package com.gildedrose
|
||||||
|
|
||||||
|
import com.gildedrose.data.model.Item
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user