-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make CustomFicusInstances extendable
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
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
32 changes: 32 additions & 0 deletions
32
...tils/src/test/scala/pl/touk/nussknacker/engine/util/config/CustomFicusInstancesSpec.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package pl.touk.nussknacker.engine.util.config | ||
|
||
import com.typesafe.config.ConfigValueFactory.fromAnyRef | ||
import com.typesafe.config.ConfigFactory | ||
import net.ceedubs.ficus.readers.ArbitraryTypeReader._ | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
import CustomFicusInstances._ | ||
|
||
import java.io.File | ||
import java.net.URL | ||
import java.util.UUID | ||
|
||
class CustomFicusInstancesSpec extends AnyFlatSpec with Matchers { | ||
|
||
it should "decode URL using custom decoder" in { | ||
case class Container(url: URL) | ||
|
||
val config = ConfigFactory.empty().withValue("url", fromAnyRef("/absolute/path")) | ||
|
||
config.as[Container].url shouldBe new File("/absolute/path").toURI.toURL | ||
} | ||
|
||
it should "decode UUID" in { | ||
case class Container(uuid: UUID) | ||
|
||
val config = ConfigFactory.empty().withValue("uuid", fromAnyRef("a0cddbd7-0f2d-4c86-8434-8811c45f18dd")) | ||
|
||
config.as[Container].uuid shouldBe UUID.fromString("a0cddbd7-0f2d-4c86-8434-8811c45f18dd") | ||
} | ||
|
||
} |