-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorcomp-springIssue is related to Spring projects supportIssue is related to Spring projects supportctg-enhancementNew feature, improvement or change requestNew feature, improvement or change request
Description
Description
Currently we use the following approach in unit tests generation.
The code
class A(
B b
C c
methodUnderTest()
}
is converted to
class TestClass {
@InjectMocks A a
@Mock B b
@Mock C c
}
and a mapping from type to the list of models is used
B -> m11, m12, ...
C -> m21, m22, ...
There are some possible problems in this approach:
- What if the constructor contains some non-injectible field?
class A(List<int> ints)
- What if the constructor contains two fields of same non-injectible type?
class A(List<int> ints1, List<int> ints2)
- Is it possible to create some util class (may be nested or inner), that does not use Spring and has the following constructor
class Utils(B b1, B b2)
- Is it a used practice to pass to constructor some non-injectible type with injectible ones? What should we do?
class A(B b, List<int> ints)
Metadata
Metadata
Assignees
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorcomp-springIssue is related to Spring projects supportIssue is related to Spring projects supportctg-enhancementNew feature, improvement or change requestNew feature, improvement or change request
Type
Projects
Status
Todo