Skip to content

Support for indirect dependant invocations #9

@mkotsbak

Description

@mkotsbak

I looked at some code that could be useful for using this tool on, and discovered a problem. Typically in EJB session/entity beans code in the logic methods you call some variation of:

getAnEntityBeanUtil.getLocalhome().findSomethingInDB(aParameter);

I think it is the same as this feature in JMock tries to solve. See question "Can I stub chained getters?" in: http://code.google.com/p/mockito/wiki/FAQ
and
http://mockito.googlecode.com/svn/tags/latest/javadoc/org/mockito/Mockito.html#RETURNS_DEEP_STUBS

Without any special care, if you place the dependency annotation in the class containing getAnEntityBeanUtil(), you will record a return value with a halfway living object that wants to do jndi lookup, which will fail in the test run. So you want to mock 2 layers before getting and playing back real return values. We then maybe need a third annotation to indicate this, something like "mockthrough, bypass, mock, chained".

How is this working in the .NET version? Is it supported, and if not, is it not a relevant case for usual programming patterns there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions