@pierodibello
Sandro Mancuso Style
still need to think about 🤔
I wonder if this approach could work when working in a team and with a "real project" (something you work on for weeks, months, not days) 🤔
Mocking Spark objects (like "Request" or "Response") mean you have to know in advance the Spark Web Framework, because otherwise you could not know which method Spark will really call in the end...
Sandro often works and codes with many still unresolved compilation errors, which - I understand - is part of his flow and approach...
Sometimes this goes too far (e.g. you have syntax issues you cannot spot because everything is red...)
Again, I think you have to have a strong focus to not get lost while having to deal with many compilation errors
PostServiceShould, LoginAPIShould, UserRepositoryShould inform_when_a_username_is_already_taken return_user_matching_valid_credentials return_all_users detect_a_following_already_exists
Integration test classes are named with an "IT_" prefix
Extensive use of constants in the tests to stand for fixed values
I normally create them as constants because I don't care what they are..."
E.g. The "PostsAPI" class needs to deal with an "InappropriateLanguageException", because it's part of the logic.
It seems Sandro doesn't use interfaces when designing with TDD:
when some new collaborator emerges while writing a unit test, its implementation will be a concrete class, not an interface.
A different way is the "interface discovery" approach followed by Steve Freeman and Nat Pryce, explained in "Growing Object-Oriented Software, Guided by Tests"
UserService.createUser(registrationData) implemented.
When writing a test, I always start from the bottom: the assertion (this is what I expect to happen). (ASSERT)
Then I ask: 'what should I need to trigger this?' (ACT)
Then I think at the bare minimum I have to do in order to have all in place. (ARRANGE)
It's all about confidence. If I don't know, I take small steps, I put all in the same class and then refactor later, when I'll be GREEN.
@pierodibello
@xpeppers