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
import akka.actor.testkit.typed.scaladsl.ActorTestKit | |
import akka.stream.scaladsl.{Sink, Source} | |
import org.scalatest.flatspec.AnyFlatSpecLike | |
import scala.concurrent.Future | |
//akka 2.6.5 | |
//zio 1.0.3.5-RC | |
class PublisherTest extends AnyFlatSpecLike { |
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
scenario-name: "Lukasz orders XL margarita on crust with chees to his default addrress" | |
given { | |
users: [{name: "Lukasz", address: {line1: "Elm Street", line1:"12", city: "Warsaw"}}] | |
funds: [{user: "Lukasz", funds: "200.00"}] | |
} | |
when { | |
make-orders: [ | |
{ | |
order-name: "Lukasz's 1st order", user: "Lukasz", items: { |
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
package com.zuchos.pizzeria | |
import com.zuchos.pizzeria.PizzaOrderingService.Composition.PredefinedComposition | |
import com.zuchos.pizzeria.PizzaOrderingService.{Composition, CompositionId, Crust, Size} | |
import com.zuchos.pizzeria.PizzaOrderingService.OrderedItem.Pizza | |
import org.scalatest.{EitherValues, FlatSpec, Matchers} | |
import org.scalatest.concurrent.{Eventually, IntegrationPatience, ScalaFutures} | |
class PizzaOrderingServiceSpec extends FlatSpec with ScalaFutures with EitherValues with Eventually with Matchers with IntegrationPatience { |
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
trait AcceptanceSpec | |
extends FlatSpecLike | |
with BeforeAndAfterEach | |
with Matchers | |
with LazyLogging | |
with AbstractPatienceConfiguration | |
abstract class StoreAcceptanceSpec | |
extends TestKit(ActorSystem("StoreAcceptanceSpec")) | |
with AcceptanceSpec |
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
import org.scalatest.{BeforeAndAfterEach, FlatSpecLike, Suite} | |
trait BaseSpec extends Suite with BeforeAndAfterEach { | |
override protected def beforeEach(): Unit = { | |
super.beforeEach() | |
println("Before Each Base Spec") | |
} | |
} | |
abstract class ExtendedBaseSpec(val name:String) extends BaseSpec { | |
override protected def beforeEach(): Unit = { |
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
trait AcceptanceSpec | |
extends FlatSpecLike | |
with TestFutureHelpers | |
with ScalaFutures | |
with BeforeAndAfterAll | |
with OptionValues | |
with TryValues | |
with EitherValues | |
with Eventually | |
with Matchers |
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
prettifier.isValid("HPJD-72036-HAPK-58077") should be(true) |
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
prettifiedWithLeading.toIdSeed("AAAA-00000-AAAA-00013") should be(Right(1L)) |
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
class IdPrettifier( | |
encoder: Codec = new AlphabetCodec(Alphabet.Base23), | |
partsSize: Int = 5, | |
delimiter: Char = '-', | |
leadingZeros: Boolean = true | |
) |
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
//create instance of it | |
val generator:StringIdGenerator = PrettyIdGenerator.singleNode | |
//generate ids | |
val stringId = generator.nextId() | |
stringId shouldNot be(empty) | |
stringId should fullyMatch regex """[A-Z]{4}-[0-9]{5}-[A-Z]{4}-[0-9]{5}""" | |
//or it might be used just for encoding existing ids | |
val prettifier = IdPrettifier.default |
NewerOlder