Sha256: 7f094a32ef1a4300102715f8f823f56eae2e875fa4a07d953dea1bbbbf569dd7

Contents?: true

Size: 1.39 KB

Versions: 248

Compression:

Stored size: 1.39 KB

Contents

import org.scalatest.{FunSuite, Matchers}
import java.time.LocalDate
import LensPerson._

class LensPersonTest extends FunSuite with Matchers {
  val testPerson =
    Person(
        _name = Name(
            _foreNames = "Jane Joanna",
            _surName = "Doe"),
        _born = Born(
            _bornAt = Address(
                _street = "Longway",
                _houseNumber = 1024,
                _place = "Springfield",
                _country = "United States"),
            _bornOn = toEpochDay(1984, 4, 12)),
        _address = Address(
            _street = "Shortlane",
            _houseNumber = 2,
            _place = "Fallmeadow",
            _country = "Canada"))

  def toEpochDay(year: Int, month: Int, dayOfMonth: Int) =
    LocalDate.of(year, month, dayOfMonth).toEpochDay

  test("bornStreet") {
    bornStreet(testPerson._born) should be ("Longway")
  }

  test("setCurrentStreet") {
    pending
    (setCurrentStreet("Middleroad")(testPerson))._address._street should be ("Middleroad")
  }

  test("setBirthMonth") {
    pending
    setBirthMonth(9)(testPerson)._born._bornOn should be (toEpochDay(1984, 9, 12))
  }

  test("renameStreets birth") {
    pending
    renameStreets(_.toUpperCase)(testPerson)._born._bornAt._street should be ("LONGWAY")
  }

  test("renameStreets current") {
    pending
    renameStreets(_.toUpperCase)(testPerson)._address._street should be ("SHORTLANE")
  }
}

Version data entries

248 entries across 248 versions & 1 rubygems

Version Path
trackler-1.0.3.0 tracks/scala/exercises/lens-person/src/test/scala/LensPersonTest.scala
trackler-1.0.2.1 tracks/scala/exercises/lens-person/src/test/scala/LensPersonTest.scala
trackler-1.0.2.0 tracks/scala/exercises/lens-person/src/test/scala/LensPersonTest.scala
trackler-1.0.1.2 tracks/scala/exercises/lens-person/src/test/scala/LensPersonTest.scala
trackler-1.0.1.1 tracks/scala/exercises/lens-person/src/test/scala/LensPersonTest.scala
trackler-1.0.1.0 tracks/scala/exercises/lens-person/src/test/scala/LensPersonTest.scala
trackler-1.0.0.1 tracks/scala/exercises/lens-person/src/test/scala/LensPersonTest.scala
trackler-1.0.0 tracks/scala/exercises/lens-person/src/test/scala/LensPersonTest.scala