Refactor: Separate packages\files

This commit is contained in:
Denys 2025-05-11 10:40:06 +12:00
parent 4f4d0243a0
commit b5b7ffc870
5 changed files with 24 additions and 24 deletions

View File

@ -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)

View File

@ -1,19 +1,7 @@
package com.gildedrose
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)
)
}
import com.gildedrose.data.constants.ItemRepository
//asd
fun main(args: Array<String>) {

View File

@ -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)
)
}

View File

@ -0,0 +1,3 @@
package com.gildedrose.data.model
data class Item(var name: String, var sellIn: Int, var quality: Int)

View File

@ -1,5 +1,6 @@
package com.gildedrose
import com.gildedrose.data.model.Item
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test