Skip to content

Mixing Java and Spring annotations.  #103

@slowikps

Description

@slowikps

Whenever one mix Java and Spring annotations:

  • org.springframework.beans.factory.annotation.Autowired
  • javax.annotation.Resource

and create a test:

public class MyTest {

    @Tested
    private TestedClass testedClass;

    @Injectable
    @Mocked
    private SomeService annotatedWithAutowired

    @Injectable
    @Mocked
    private SomeService annotatedWithResource
}

class TestedClass {
    @Autowired
    private SomeService1 annotatedWithAutowired;

    @Resource
    private SomeService2 annotatedWithResource;
}

only fields with Java annotations are injected to @tested object.

What I think need to be fixed/redesign is a discardFieldsNotAnnotatedWithJavaxInjectIfAtLeastOneIsAnnotated method inside
mockit.internal.expectations.injection.FieldInjection class

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions