Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-1116

allow conditional injection-point customization in test-classes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.6.0
    • 1.6.1
    • TestControl
    • None

    Description

      CdiTestRunner first injects into @Inject fields of the test class in CdiTestRunner.createTest(). I'm absolutely fine with that as this makes it possible to use injected beans in a @Before method or even in a JUnit TestRule.

      But shortly before executing the actual test method, CdiTestRunner.ContainerAwareMethodInvoker.evaluate() injects again, overwriting any changes that have been made to the fields in a JUnit TestRule or a @Before method in the test.

      The second injection was introduced by DELTASPIKE-342:
      https://git-wip-us.apache.org/repos/asf?p=deltaspike.git;a=commitdiff;h=2d44e7d2980f8ab0b0a2a388255c0f0944c85098
      I don't know why there needs to be a second injection at all.
      All tests pass when I remove the second BeanProvider.injectFields(...).

      PS: deltaspike.testcontrol.use_test_class_as_cdi_bean is false, which is the default value.

      Attachments

        1. DELTASPIKE-1116.zip
          5 kB
          Falko Modler

        Activity

          People

            gpetracek Gerhard Petracek
            famod Falko Modler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: