Thanks for making good content for us, I would appreciate if you make some content on internal of JUnit Framework and how different annotations on class level like @JsonTest/@MockitoExtension works with JUnit framework.
@codewitharho Жыл бұрын
Looks like I have forgotten to reply, but that sounds like a good idea for better understanding.
@z00lus3 жыл бұрын
Quick , informative video. Nothing more than need. Just perfect! Subscribe
@codewitharho3 жыл бұрын
Thanks! I try to keep it short :)
@anunymous73 жыл бұрын
100th subscriber. Yay!
@sangtv_AK3 жыл бұрын
Hi Arho, thank you for sharing your knowledge. I appreciate your time and consideration. P.S: I suggest you upload a video to tell the audience about your channel's content on your KZbin's home page.
@codewitharho3 жыл бұрын
Thanks for the suggestion! I will surely look into it.
@mohankumarc26053 жыл бұрын
Kindly do a video on private method refactoring , so it can be unit tested concept. Greatly appreciate your time and help
@codewitharho3 жыл бұрын
Appreciate the feedback, I will definitely put this into my list of possible videos. Thanks!
@sohrabsheykhmohammadi19092 жыл бұрын
awesome
@codewitharho2 жыл бұрын
Thanks!
@sanu76113 жыл бұрын
When I run whole test class some methods are failing, when I run single test in class then it is passing.why so??
@codewitharho3 жыл бұрын
Some tests leave behind state that affects the other tests.
@Hawkeeye7473 жыл бұрын
Can u elaborate as to why is it bad practice to mock private methods?
@codewitharho3 жыл бұрын
The main reason is that the test becomes more coupled to the implementation. When we mock private methods (or test private methods), every time we want to change the implementation, the test will break. One of the biggest reasons why people think that unit testing suck is when they have coupled the tests too tightly to the implementation. We should focus on testing the behaviour of the class, but mocking a private method means that we alter the internal behaviour. So we should apply mocking only to external dependencies and not the class itself. If there is a "bad" dependency in a private method, we should consider refactoring so that it becomes an external dependency.
@evanderstewart23203 жыл бұрын
Is there a way to mock private methods using JUnit 5 as I'm trying with PowerMock, but with no success?
@codewitharho3 жыл бұрын
I usually suggest refactoring the code so that you don’t have to. For example, if a private method is calling something that you want to mock, make that a dependency of the class instead.
@Hawkeeye7473 жыл бұрын
@@codewitharho okay so when the private method is run in the test it would run the mocked method inside its body?
@codewitharho3 жыл бұрын
@@Hawkeeye747 yes, the class would have a dependency to another class, and the private method would call a method in that other class, which would then be mocked.
@mangethegamer3 жыл бұрын
Please don't use music while you talk in the video.
@codewitharho3 жыл бұрын
Yeah, I have received similar feedback. Fixed in newer videos!