Skip to content

Same design strategy of Solution #1 Take #1 but with the brand new Java ... #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

matteobaglini
Copy link
Contributor

...8's lambda. Without the AnonimousClass verbosity the code is a lot more readable.

…va 8's lambda. Without the AnonimousClass verbosity the code is a lot more readable.
@giancosta86
Copy link
Contributor

Very brilliant and elegant idea! ^_^!
Of course, possible only if we can freely change the Service without breaking existing dependencies X___X'.
I'm just performing a small change to reduce the visibility of the variable modified by the lambdas! ^
^

@matteobaglini
Copy link
Contributor Author

Through refactoring, tiny steps and parallel design we can put this design in production without breaking existing dependencies. Given that, the tests use mock objects, they are heavily coupled to the Service interface so, in order to introduce my design, without getting red bar, I have already had to use the parallel design technique.

@arialdomartini
Copy link
Contributor

@matteobaglini Great! Apparently, I belong to the London TDD School and you are likely to sympathize with the Chigago (or Detroit?) one. It's pretty funny that such simple code quizzes could hide so many interesting sides, isn't it?

I would love the same tests converted to a different style, more state based and less coupled to the interface.
Would you like to try?

@matteobaglini
Copy link
Contributor Author

@arialdomartini sure, but in this simple case the switch of testing style will not produce a really different test. This because despite the use of a moking framework the injected service test duble is a stub (not a mock). In the Chigago style we can use read object (preferred choice) or stubbed dependencies (regardless of whether they are done handmade or with a framework).

Sum up, the final result would be the same. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants