Skip to content

Commit

Permalink
#17 in progress
Browse files Browse the repository at this point in the history
- fix for build pipeline
  • Loading branch information
mjureczko committed Mar 6, 2025
1 parent 730d466 commit 3207fa5
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package pl.marianjureczko.poszukiwacz.model

import com.ocadotechnology.gembus.test.CustomArranger
import com.ocadotechnology.gembus.test.some

class HunterPathArranger : CustomArranger<HunterPath>() {
override fun instance(): HunterPath {
val instance = super.instance()
instance.addLocation(some())
return instance
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package pl.marianjureczko.poszukiwacz.model

import com.ocadotechnology.gembus.test.CustomArranger
import com.ocadotechnology.gembus.test.some
import com.ocadotechnology.gembus.test.someObjects
import com.ocadotechnology.gembus.test.someString
import pl.marianjureczko.poszukiwacz.shared.port.StorageHelper
import java.io.File

class RouteArranger : CustomArranger<Route>() {
companion object {

fun saveWithTreasureDescription(treasureDescription: TreasureDescription, storageHelper: StorageHelper): Route {
val route = Route(someString(), mutableListOf(treasureDescription))
storageHelper.save(route)
return route
}

fun savedWithTipFiles(storageHelper: StorageHelper): Route {
val route = some<Route>()
route.treasures.forEach { t ->
t.instantiatePhotoFile(storageHelper).createNewFile()
t.tipFileName = storageHelper.newSoundFile()
File(t.tipFileName).createNewFile()
}
storageHelper.save(route)
return route
}

fun routeWithoutTipFiles(): Route {
val route = some<Route>()
route.treasures.forEach { t ->
t.photoFileName = null
t.tipFileName = null
}
return route
}

fun withNameAndTreasureWithQrCode(name: String, qrCode: String): Route {
val route = some<Route>().copy(name = name)
route.treasures.first().qrCode = qrCode
return route
}
}

override fun instance(): Route {
return Route(some<String>(), someObjects<TreasureDescription>(3).toMutableList())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package pl.marianjureczko.poszukiwacz.model

import com.ocadotechnology.gembus.test.CustomArranger
import com.ocadotechnology.gembus.test.someDouble
import com.ocadotechnology.gembus.test.someFrom
import com.ocadotechnology.gembus.test.someInt
import com.ocadotechnology.gembus.test.somePositiveInt

class TreasureDescriptionArranger : CustomArranger<TreasureDescription>() {

companion object {
fun validQrCode(treasureType: String = someFrom(setOf("g", "r", "d", "k"))): String {
val quantity = someInt(10, 99)
val id = somePositiveInt(99)
return "$treasureType$quantity$id"
}
}

override fun instance(): TreasureDescription {
return super.instance().copy(
qrCode = validQrCode(),
latitude = someDouble(-90.0, 90.0),
longitude = someDouble(-180.0, 180.0)
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package pl.marianjureczko.poszukiwacz.model

import com.ocadotechnology.gembus.test.CustomArranger
import com.ocadotechnology.gembus.test.some
import com.ocadotechnology.gembus.test.someString

class TreasuresProgressArranger : CustomArranger<TreasuresProgress>() {
override fun instance(): TreasuresProgress {
val instance = super.instance()
val treasureDescription = some<TreasureDescription>()
instance.routeName = someString()
instance.collect(some<Treasure>(), treasureDescription)
instance.addCommemorativePhoto(treasureDescription, someString())
// instance.hunterPath.addLocation(Coordinates(some<Double>() % 180, some<Double>() % 90))
return instance
}
}

0 comments on commit 3207fa5

Please sign in to comment.