Last active
February 17, 2020 15:36
-
-
Save choplin/0c1e768914255170535562d4beaae647 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
ParametricInjection: | |
- design 7.23ms | |
- Foo[Int] should be built 2.43ms | |
- ConcreteService 6.56ms | |
2020-02-18 00:27:43.775+0900 warn [AirframeSession] [session:206e6537 -> session:1cb108eb] No binding nor the default constructor for _ at ParametricInjection.scala:7 is found. Add bind[_].toXXX to your design or dependencies. The dependency order is: [Foo[_] -> _] - (AirframeSession.scala:452) | |
- ParametricService[Int] should be built 33.45ms << error: Failed to call ParametricInjection.`ParametricService[Int] should be built`. Missing dependency for ParametricService[Int]: | |
[MISSING_DEPENDENCY] Binding for _ at ParametricInjection.scala:7 is not found: _ <- Foo[_] | |
wvlet.airspec.spi.MissingTestDependency: Failed to call ParametricInjection.`ParametricService[Int] should be built`. Missing dependency for ParametricService[Int]: | |
[MISSING_DEPENDENCY] Binding for _ at ParametricInjection.scala:7 is not found: _ <- Foo[_] | |
at wvlet.airspec.AirSpecDef.resolveArg(AirSpecDef.scala:31) | |
at wvlet.airspec.AirSpecDef.resolveArg$(AirSpecDef.scala:14) | |
at wvlet.airspec.AirSpecDefF1.resolveArg(AirSpecDef.scala:58) | |
at wvlet.airspec.AirSpecDefF1.run(AirSpecDef.scala:67) | |
at wvlet.airspec.runner.AirSpecTaskRunner.$anonfun$runSingle$7(AirSpecTaskRunner.scala:197) | |
at scala.util.Try$.apply(Try.scala:210) | |
at wvlet.airspec.runner.AirSpecTaskRunner.$anonfun$runSingle$6(AirSpecTaskRunner.scala:196) | |
at wvlet.airframe.Session.withChildSession(Session.scala:117) | |
at wvlet.airframe.Session.withChildSession$(Session.scala:113) | |
at wvlet.airframe.AirframeSession.withChildSession(AirframeSession.scala:32) | |
at wvlet.airspec.runner.AirSpecTaskRunner.runSingle(AirSpecTaskRunner.scala:184) | |
at wvlet.airspec.runner.AirSpecTaskRunner.$anonfun$runSpec$6(AirSpecTaskRunner.scala:140) | |
at wvlet.airspec.runner.AirSpecTaskRunner.$anonfun$runSpec$6$adapted(AirSpecTaskRunner.scala:139) | |
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:553) | |
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:551) | |
at scala.collection.AbstractIterable.foreach(Iterable.scala:921) | |
at wvlet.airspec.runner.AirSpecTaskRunner.$anonfun$runSpec$5(AirSpecTaskRunner.scala:139) | |
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) | |
at wvlet.airframe.Session.start(Session.scala:133) | |
at wvlet.airframe.Session.start$(Session.scala:130) | |
at wvlet.airframe.AirframeSession.start(AirframeSession.scala:32) | |
at wvlet.airspec.runner.AirSpecTaskRunner.runSpec(AirSpecTaskRunner.scala:139) | |
at wvlet.airspec.runner.AirSpecTaskRunner.run(AirSpecTaskRunner.scala:106) | |
at wvlet.airspec.runner.AirSpecTaskRunner.$anonfun$runTask$1(AirSpecTaskRunner.scala:62) | |
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) | |
at wvlet.airspec.Compat$.withLogScanner(Compat.scala:77) | |
at wvlet.airspec.runner.AirSpecTaskRunner.runTask(AirSpecTaskRunner.scala:49) | |
at wvlet.airspec.runner.AirSpecTask.execute(AirSpecTask.scala:64) | |
at wvlet.airspec.runner.AirSpecTask.execute(AirSpecTask.scala:42) | |
at java.util.concurrent.FutureTask.run(FutureTask.java:266) | |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) | |
Execution took 48ms | |
4 tests, 3 passed, 1 errors |
This file contains hidden or 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 wvlet.airframe._ | |
import wvlet.airspec._ | |
case class Foo[A](a: A) | |
trait ParametricService[A] { | |
private val alg = bind[Foo[A]] | |
} | |
trait ConcreteService { | |
private val alg = bind[Foo[Int]] | |
} | |
class ParametricInjection extends AirSpec { | |
override def design: Design = | |
Design.newDesign | |
.bind[Foo[Int]].toInstance(Foo(0)) | |
.bind[ConcreteService].toSingleton | |
.bind[ParametricService[Int]].toSingleton | |
test("Foo[Int] should be built") { _: Foo[Int] => | |
} | |
test("ConcreteService should be built") { _: ConcreteService => | |
} | |
test("ParametricService[Int] should be built") { _: ParametricService[Int] => | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment