Junilu Lacar wrote:
Raja Avrv wrote:
The service class actually does all the computation, so I thought I could just test that the controller calls the service (using verify) here and that I can see the result of that service call come out of the controller (through expect). Is that expect maybe not necessary?
1. Your test method name does not give that impression
2. The test code does not clearly communicate its intent
Junilu Lacar wrote:Line 10 of the test looks very wrong to me. Especially when you look at line 22.
Stephan van Hulst wrote:There's very little I can say about the correctness of your test without knowing what it is testing.
What is subject? Why are you mocking the word counting service?
Campbell Ritchie wrote:There's a space in that regex, too. I am not sure I like that regex; it will have to get bigger every time you add a punctuation mark. It also risks producing zero‑length Strings whenever separating characters are juxtaposed. I might consider something like this instead, using "\\w+" to match. You can augment that regex to permit included apostrophes and hyphens, etc.
Himai Minh wrote:Hi Raja,
You can encode the password in a database. Here is an example : https://www.baeldung.com/spring-security-registration-password-encoding-bcrypt
Could all of the individual conversions (from input to InputInLowerCase and content to ContentInLowerCase) be avoided and the case ignore comparison be done within the stream and filter functions?
Paul Clapham wrote:Which one? There's several instances of converting to lower case in your code.