jsalazare / just-crud

0 stars 0 forks source link

Groovy style comments #1

Open rvazquezglez opened 4 years ago

rvazquezglez commented 4 years ago

In Groovy ; are not needed https://github.com/jsalazare/just-crud/blob/6319a77529cb346e242b4c8952f2eca32089c200/src/test/groovy/com/jsalazar/justcrud/service/UserServiceImplTest.groovy#L44

Usually when accessing properties Groovy automatically calls the getter method. For example the next line https://github.com/jsalazare/just-crud/blob/6319a77529cb346e242b4c8952f2eca32089c200/src/test/groovy/com/jsalazar/justcrud/service/UserServiceImplTest.groovy#L141

can be changed to something like:

assertEquals("products id should be 1", 1, actualUsers.products[0].id)

Something similar happens for setter methods: https://github.com/jsalazare/just-crud/blob/6319a77529cb346e242b4c8952f2eca32089c200/src/test/groovy/com/jsalazar/justcrud/service/UserServiceImplTest.groovy#L165

This expression

product.id = 1

Calls the setId method.

jsalazare commented 4 years ago

Right, thank you, I added them by mistake, I removed all unnecessary semicolons.

All class attributes by default are private, but didn't know that directly calling .attributeName will call getters or setters. thanks

I just upload some changes