Knotx / knotx-junit5

JUnit 5 support and extensions for Vert.x projects
https://knotx.io
Apache License 2.0
0 stars 4 forks source link

Intialization of Knot.x w/o variable in method/class signature #54

Open tMaxx opened 4 years ago

tMaxx commented 4 years ago

Background Currently, we initalize Knot.x instance from provided configuration only when an appropriate variable type is present in a given class, or on a given method. As a result, tests that need to interact with Knot.x indirectly will have some unneeded code inside - for example we need to test a service that interacts with Knot.x, but we don't need to extend it in any way, yet we will still need to declare Vert.x variables and contexts.

Expected behavior There should be a way to force initalization of Knot.x instance without the need to declare all variables (Vert.x instance and test context). This can be potentially done in two ways:

  1. Add an explicit flag/annotation that will force initialization of Knot.x when there are no method/class variables present;
  2. Detect following: presence of @KnotxApplyConfiguration on method/class and lack of Vert.x variables in method/class, and then initalize Knot.x instance.

Also:

Things to keep in mind